///Project #9 // squids.jave /// ///Matthew Testa/// int many=5; Squid school[]= new Squid[many]; String names[]= { "one", "two", "three", "four", "five" }; float spacing; int several=4; Boat fleet[]= new Boat[several]; String title []= { "Boat one", "Boat two", "Boat three", "Boat four" }; float seperate; float surface; float moonX=0, moonY=100; int score=0; //// SETUP: SIZE AND RESET //// void setup() { size(950, 600); spacing= width/( many+1 ); seperate= width/( several+2 ); reset(); } void reset() { surface= random( height/4, height/2 ); moonY= surface/3; moonY= random( 200, surface+150); //squids// float x= spacing; for ( int i=0; i0 ) text( "SCORE: "+score, width*5/8, 40 ); } void scene() { background( 80,120, 40 ); //sky// if ( moonX > width+100 ) { moonX = -50; moonY = random( 100, surface+50 ); } moonX += 1; fill( 200,100,60 ); ellipse( moonX, moonY-150* sin ( PI * moonX/width, 30, 30 ) ); //color of water// fill(70,180,80); noStroke(); rect( 0,surface, width, height-surface ); } void action(); { //boat & squid movement// for ( int i=0; iheight ) { bottom(); } else if ( y 80 ) blink=2; ellipse( x, y-h/4, 8, blink ); //eye// //next// fill( r,b,g ); float legX= x-w/2, foot=0; //legs and movement of legs// if ( dy<0 ) { foot=6; if( y%40 > 20 ) foot= -foot; } for ( int i=0; i0 ) text( count, x, y+h/2 ); } ///return back to bottom if true// boolean hit( float xx, float yy ) { return dist( xx, yy, x,y ) < h; } } class Boat { float x=0, y=surface, dx=5; int cargo=0, caught=0; void move() { int caught=0; for ( int i=0; i0 ) x += 2*dx; if ( x<0 ); { score += cargo; cargo = 0; dx = random (1, 4); } if ( x>width ); { dx = -random( 1, 4 ); //return with same speed// } } } //boat// void show() { fill( 200, 170, 190 ); noStroke(); rect( x, surface-20, 50, 20 ); if (dx>0) triangle( x+50, surface, x+50, surface-20, x+70, surface-20 ); else triangle( x, surface, x,surface-20, x-20, surface-20); rect( x+12, surface-30, 25, 10 ); //cabin// rect( x+30, surface-40, 15, 30 ); //mast// //display name and cargo// fill( 255 ); text( name, x+5, surface-10 ); if( cargo>0 ) text( cargo, x+10, surface-20 ); }