/// Alexa Trejo /// Midterm float horizon; float octX, octY, octDX=3, octDY=2; float boatX, boatY, boatDX=3, boatDY=2; float w; float h; float x; float y; float spd; void setup() { size( 600, 700 ); horizon= height/3; fill( 18, 127, 193 ); // rect( 1, 600, 600, 300 ); // rectMode( CENTER ); /// code used to try and make the boat move //// //boatX=0; // boatY=300; //boatDX=100; // boatDY=100; //spd=6; x=0; y=300; w=100; h=100; spd=6; } void draw() { /// NEXT FRAME // scene(); action(); show(); /*BAM*/ text( "WHO?????", 20, 20); /*BAM*/ grading(); } void scene() { background( 122, 200, 247 ); // sky // fill( 18, 127, 193 ); // ocean // rectMode( CORNER ); rect( 0, horizon, width+50, 500, 5 ); } void action() { // octopus // octX= octX + octDX; octY= octY + octDY; // make octopus stay within screen // if (octX>width || octX<0) { octDX= - octDX; } if (octX>height || octY<0) { octDY= - octDY; } // attempting to make the boat move. Tried two way and neither worked // //x+=spd; // if( boatX+boatDX>600) { boatX=-10; boatY= random( 500 ); boatDY= random( 30, 100 ); boatDX=boatDY; //spd= random(3,12); /*BAM*/ boatX += spd; text( boatX, 10, 10 ); //x+=spd; // if( boatX+boatDX>600) { boatX=-10; boatY= random( 500 ); boatDY= random( 30, 100 ); boatDX=boatDY; //spd= random(3,12); if( x+w>600) { x=-10; y=random( 500 ); h= random( 30, 100 ); w= h; spd=random(3,12); } } void show() { rectMode( CENTER ); /// oct /// fill( 135, 10, 240 ); ellipse( octX, octY, 90, 60 ); // boat // fill( 255, 3, 32 ); rect( 100, 210, 100, 60); /*BAM*/ boatY= horizon; /*BAM*/ rect( boatX, boatY, 100, 60); /*BAM*/ text( "See bam's code", boatX, boatY+30 ); noStroke(); // Attempted to make the triangular front of the boat // //triangle( boatX, boatY, boatDX, boatDY, 86, 75 ); //triangle( horizon-100, horizon-50, horizon-50, horizon+25, horizon+100, horizon+70); // fishes // //triangle( x-w/2 } //////// NOTES & GRADING //////// String notes="\n\nNOTES:" +"\n No title, author, score, etc." +"\n Boat does not move." +"\n No fish, no octopus" +"\n Sun? Moon? Day/night?" +"\n " +"\n No click, no keys" +"\n " +"\n " +"\n " ; //////// END NOTES STRING //////// String grading="" //////// PASTE GRADING HERE //////// +" SYNTAX read SCENE move keys | BOAT move click | OCTO move click | FISH move school :\t MID 51CST112 \n" +" compile // sky+sea right q,r | rect left/rt stop/go | dome up/dn kill | ellipse right behind&below :\t 5 MW93 \n" +" draw() modular sun day/nite score | tri <> catch | 8 leg wiggle ran x | many rand y ran # :\t 5 30 \n\n" +" 10 10 10 10 10 | 10 10 10 | 10 10 10 | 10 10 10 :\t 175 *1.25 \n" +" 10 10 8 2 0 | 4 0 | 3 4 | 0 :\t 65 Trejo \n" ; //////// END GRADING STRING //////// /** Display grading string. */ char lastkey='#'; void grading() { if (keyPressed) lastkey=key; fill(0); if (lastkey == '=') text( grading+notes, 2, height/2 ); else if (lastkey=='#') text( "Press '=' key for grading.", 10, height/2 ); }