//variables to move the fish int tx, ty; int tx2, ty2; //a function to set up the general drawing parameters void setup() { size(800, 600); background(#66BFC6); smooth(); tx = 750; ty = 100; frameRate(70); tx2 = 0; ty2 = 350; } //press any key to reset the fish void keyPressed() { tx = 400; ty = 100; } //function to draw the fish void drawFish() { fill(#D65E32); stroke(0); ellipse(0, 0, 30, 10); triangle(15, 0, 28, -10, 28, 10); stroke(255); fill(0); rect(-10, -3, 4, 2); } //function to draw the fish void drawFish2() { fill(#D65E32); stroke(0); ellipse(0, 0, 30, 10); triangle(-15, 0, -28, -10, -28, 10); stroke(255); fill(0); rect(10, -3, 5, 3); } //the draw function - which will loop void draw() { background(#62C2D8); //draw the fish in an updated position using variables pushMatrix(); translate(tx, ty); drawFish(); popMatrix(); //update my variables - either randomly update y or use sin tx = tx - 1; //ty = ty + int(random(-5, 5)); ty = 100 + int(30*sin(tx/400.0*6*PI)); //draw the fish in an updated position using variables pushMatrix(); translate(tx2, ty2); drawFish2(); popMatrix(); //update my variables - either randomly update y or use sin tx2 = tx2 + 1; //ty = ty + int(random(-5, 5)); ty2 = 350 + int(30*sin(tx/400.0*6*PI)); }