/** octopus should alternate from bottom to surface it should alternate the slant of it's limbs such that the ends of the limbs may start slanted at the right or left when it travels from the bottom to the surface (study Project_II birds and draw slanted lines both ways in for statements to do this) when it travels from the surface to the bottom, the limbs should be vertical with no slant **/ //floats float birdX; float sunX = 100; float moonX = 100; float witchX; float octX; float octY; //integers int surface = height / 4; //strings String title = "Takehome"; String author = "Jenna Klima"; //booleans boolean day = false; void setup ( ) { //setup size ( 600, 500 ); background ( 50 ); } void draw ( ) { //draw all these things background ( 50 ); scene ( ); //-- borders ( ); bird ( ); witch ( ); octopus ( ); button ( ); } void scene ( ) { //what the background will look like size ( 600, 500 ); background ( 50 ); //sky if ( day == true ) { //day noStroke ( ); fill ( 100, 100, 200 ); rect ( 0, 0, width, height / 1.3 ); //draw sun fill ( 255, 255, 0 ); ellipse ( sunX, 50, 50, 50 ); sunX = sunX + .5; witchX = width + 500; octX = width + 500; } if ( day == false ) { //night noStroke ( ); fill ( 30 ); rect ( 0, 0, width, height / 1.3 ); birdX = width + 500; octX = width / 2 - 300; //draw moon noStroke ( ); fill ( 255, 200, 255 ); ellipse ( moonX, 50, 50, 50 ); fill ( 30 ); ellipse ( moonX + 20, 50, 50, 50 ); moonX = moonX + .5; } //sun functionality if ( sunX == width + 50 ) { sunX = -50; day = false; } //moon functionallity if ( moonX == width + 50 ) { moonX = -50; day = true; } //ocean noStroke ( ); fill ( 20, 20, 120 ); rect ( 0, height / 4, width, height ); //return stroke to 0 stroke ( 0 ); } /* void borders ( ) { //semicircles for ( int j = 0; j < width; j = j++ ) { fill ( 200 ); ellipse ( j, 10, 10, 10 ); } } */ void bird ( ) { //draw bird and make it fly noStroke ( ); fill ( 150, 0, 200 ); //draw tail triangle ( birdX + width - 5, 25, birdX + width - 5, 75, birdX + width - 30, 50 ); //draw beak triangle ( birdX + width - 5, 40, birdX + width - 5, 60, birdX + width - 50, 50 ); //make bird move birdX = birdX - 5; //reset bird if ( birdX == -width + 50 ) { birdX = width + 500; birdX = birdX - 5; } //return stroke to 0 stroke ( 0 ); } void witch ( ) { //draw a witch that flies on a broom at night noStroke ( ); rectMode ( CENTER ); //body fill ( 100, 50, 0 ); rect ( width - 80 + witchX, height / 4, 40, 75, 35 ); //broomstick fill ( 255, 100, 0 ); rect ( width / 1.15 + witchX, height / 3, 100, 10, 35 ); //head fill ( 255, 0, 0 ); ellipse ( width - 80 + witchX, height / 7, 40, 40 ); //broom bristles fill ( 255, 100, 0 ); triangle ( width - 20 + witchX, 145, width - 20 + witchX, 185, width - 40 + witchX, 180 - 14 ); for ( int j = height / 2 - 100; j < height / 2.75; j = j + 5 ) { strokeWeight ( 3 ); stroke ( 255, 100, 0 ); line ( width / 2 + 280 + witchX, j, width / 2 + 300 + witchX, j ); stroke ( 0 ); } //hat fill ( 0 ); triangle ( width / 2.17 + 245 + witchX, height / 6 - 60, width / 2.17 + 275 + witchX, height / 4 - 60, width / 2.17 + 50 + 165 + witchX, height / 4 - 60 ); //legs strokeWeight ( 7 ); stroke ( 0, 255, 0 ); line ( width - 70 + witchX, height / 2 - 20, width - 70 + witchX, height / 3 - 5 ); line ( width - 90 + witchX, height / 2 - 20, width - 90 + witchX, height / 3 - 5 ); witchX = witchX - 5; if ( witchX == -width + 100 ) { witchX = width + 2200; witchX = witchX - 5; } //return stroke weight to 1 strokeWeight ( 1 ); //return stroke to 0 stroke ( 0 ); //return rectMode to default "CORNER" rectMode ( CORNER ); } void octopus ( ) { //draw an octopus //head noStroke ( ); fill ( 150, 50, 250 ); ellipse ( width / 2 + octX, height / 2 + 200 + octY, 40, 50 ); //lower part of head that makes it a semi-circle rectMode ( CENTER ); noStroke ( ); fill ( 150, 50, 250 ); rect ( width / 2 + octX, height / 2 + 210 + octY, 40, 30 ); for ( int j = width / 2 - 20; j < width / 2 + 20; j = j + 5 ) { strokeWeight ( 3 ); stroke ( 150, 50, 250 ); line ( j + octX, height / 1.1 + octY, j + octX, height / 1.1 + 35 + octY ); } octY = octY - 2; //if ( octY == 1 ) { // octY = octY + 2; //} //set rect mode back to corner rectMode ( CORNER ); //set stroke weight back to 1 strokeWeight ( 1 ); //set stroke back to 0 stroke ( 0 ); } void button ( ) { rectMode ( CENTER ); fill ( 255, 255, 0 ); rect ( width / 2 + 20, height / 2 - 11, 150, 50, 60 ); textSize ( 20 ); fill ( 0 ); text ( "button", width / 2 + 9, height / 2 - 8 ); if ( mousePressed && mouseX < width / 2 + 95 && mouseX > width / 2 - 55 && mouseY < height / 2 + 15 && mouseY > height / 2 - 38 ) { background ( 225 ); } text ( title, width / 2 + 9, height / 2 - 208 ); text ( author, width / 2 + 9, height / 2 - 108 ); rectMode ( CORNER ); } void mousePressed ( ) { } void keyPressed ( ) { }