//Aaron Brody //Titanic float A=250;//y-coordinate of water level float B=0;//x coordinates of boat float C=250;//y-coordinate of boat (for when it sinks needs to be different) float dx=1;//speed of boat float dy=1; float xstart=0; void setup(){ size(800,600); } void draw(){ skyandwater(); sun(); waves(); boat(); pause(); gameover(); sinking(); } void waves(){ float x= xstart; fill(3,254,238); while(x<=850){ ellipse(x,A,50,50); x=x+50; } xstart= xstart-dx; } void skyandwater(){ fill(10,18,90); rect(-5,A,800,350); fill(3,254,238); rect(-5,-5,805,A+5); noStroke(); } void sun(){ fill(232,227,59); ellipse(0,0,150,150); } void boat(){ fill(183,24,24); quad(B,C-25,B+20,C+25,B+110,C+25,B+130,C-25); B=B+3*dx; if (B>800) {B=-130; A=A+50; C=C+50;}} void pause(){ if (keyCode=='p' || keyCode == 'P'){ dx=0;} if (keyCode=='r' || keyCode =='R'){ dx=1;} } void gameover(){ if (A>=600){ dx=0; background(0); fill(255); text ("you suck",400,300); }} void sinking(){ if (keyCode =='s' || keyCode == 'S'){ dx=0; C=C+dy; }}