int n; //# of fish float x, y; //position float w , h; //fish size float horizon=100; float wX; String myName = "Adam Kochen"; String gName = "Fish"; float fishX,fishM=5; float z = 1,g; int textX = 10; float colourRed , colourGreen , colourBlue; float colour; void setup () { size(800,600); reset(); } void draw() { noStroke(); background(200,250,255); //sky fill(0,0,255); rect(0,horizon,width,height); //water //0-0 x = 600; //0-0 y = 300; //0-0 if(x-60*n < width){ //0-0 } x=50; y=300; w=25 * z; //y = y-random(1,5)+random(1,5); //w= 25; h= 15; fishX=fishX+fishM; fishes(fishX,y,w,h,fishM); if(fishX > width || fishX < 0){ fishM = -fishM; z = -z; }; wX=wX-4; fill(200,250,255); //-- fill(255,0,0); waves(wX,horizon,80,60); //moving waves //-- fill(0); waves(0,horizon,80,60); //still waves //test text fill(0); text("fishM "+fishM,10,textX); text("fishX "+fishX,10,textX+10); text("z "+z,10,textX+20); text("g "+g,10,textX+30); text("w "+w,10,textX+40); text("n "+n,10,textX+50); text(myName + " - " + gName,300,10); } void fish(float x,float y,float w,float h, float z ) { //fish shape ellipseMode(CENTER);//body //fill(255); ellipse(x,y,w,h); //rect(x,y,10,10); //if(fishX > width || fishX < 0){t=-t;} triangle(x-w/2+z,y,x-w,y-h/1.5,x-w,y+h/1.5); //tail } void fishes(float x,float y,float w,float h, float z ){ for( int l = 1; l < n ; l++){ fill(colourRed,colourGreen,colourBlue); fish(x,y,w,h,z); // below //birds above and below x= x - 2*w; y = y + h; } } void wave(float wx, float wy, float ww, float wh){ //-- fill(200,250,255); ellipse(wx,wy,ww,wh); //wave ellipse if(wx == 0) {wx = width;} } void waves(float wX, float wY, float wW, float wH){ float horizonY = horizon; float xx = wX; //-- for( int l = 0; l < 800;l=l+7) for( xx=wX; xx