int p; float horizon; float x= 200; float y= 300; float h= 10; float w= 15; float wavesX= -100; float wavesY = horizon; float pairs = random (2,7); float fishdirectionX = 1.5; boolean negrdx = false; void setup(){ size(800,650); horizon= height/4; reset(); } void keyPressed() { if (key =='r') reset(); } void draw() { scene(); title(); waves(); fishes(); } void title() { textSize(20); fill(255); text( "Waves",width/2.5,80); textSize(15); fill (0); text(" Jason Martin",10,height-15); } void scene(){ //sky background(120,182,255); fill(56,120,229); //Horizon rectMode(CORNER); rect(0,horizon,width,height*4); } void waves(){ // draw wave noStroke(); fill(120,182,255); ellipseMode(CENTER); // make wave loop for ( float x=wavesX;x50 ){ wavesX=-100; wavesX+=1; } } } void fishes() { //move fish x += fishdirectionX; if (x >=width+2*w*pairs){ fishdirectionX = -fishdirectionX ; negrdx =true; } if (x<0 - 2*w*pairs){ fishdirectionX = -fishdirectionX ; negrdx = !negrdx; } // draw fish fish( x,y,w,h); fishg ( p,x,y,w,h); } // fish void fish(float x, float y, float w, float h) { fill(188,29,220); ellipse(x,y,w*2,h); if (negrdx) { triangle(x+w,y, x+w+20,y-10, x+w+10,y+10); } else { triangle(x,y, x-20,y-5, x-20,y+5); } } // other fish void fishg (int p,float x,float y,float w,float h){ float xx= x; float ww=w; float yy= y; float up =0; float dy = h/3; dy= h/3; dy += h/3; //first fish fish ( xx,y,w,h); // make school of fish for (int j=0;j