//// Midterm. CST 112. Abel Cruz. String title= "Moby Dick."; String author= "Abel Cruz"; int width=640, height=480; float surface= height/4; float boatX; float boat2X= width+20; float speed=1; //float fishX; fishY; float crawX; //// SETUP //// void setup() { size( 640, 480 ); } void draw() { scene(); boatmove1(); boatmove2(); boatshow(); //fish(); //craw(); } void scene() { background(125, 198, 252); fill(22, 134, 0); rect(0, surface, width, height); } void boatmove1() { boatX=boatX + speed; if (boatX>=width-60) { boat2X=(boat2X-speed); if (boat2X<=-65) { boatX=-20; boat2X=width+20; } } } void boatmove2() { if ((boatX>=width-60) && (boat2X<=-65)) { boatmove1(); } } void boatshow() { noStroke(); ////boat to the right fill(219, 75, 97); rect(boatX, surface-20, 60, 20); rect(boatX+25, surface-30, 20, 10); triangle(boatX+60, surface, boatX+60, surface-20, boatX+80, surface-20); rect(boat2X, surface-20, 60, 20); ////boat to the left rect(boat2X+25, surface-30, 20, 10); triangle(boat2X, surface, boat2X, surface-20, boat2X-20, surface-20); }