Skip to content

Instantly share code, notes, and snippets.

@madbunnykim
Last active September 19, 2017 00:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madbunnykim/320978c0e9cfca28f6cdf01d5ad85d41 to your computer and use it in GitHub Desktop.
Save madbunnykim/320978c0e9cfca28f6cdf01d5ad85d41 to your computer and use it in GitHub Desktop.
let x;
let y;
let r = 116;
let g = 187;
let b = 277;
function setup() {
createCanvas(400, 400)
}
function draw() {
//background
let fr = frameRate (10)
background (r, g, b);
r = random (116, 200);
g = random (187, 200);
b = random (250, 280);
//grass
fill(55, 143, 80);
noStroke();
triangle(0, 400, 10, 330, 20, 400);
triangle(20, 400, 30, 330, 40, 400);
triangle(40, 400, 50, 330, 60, 400);
triangle(60, 400, 70, 330, 80, 400);
triangle(80, 400, 90, 330, 100, 400);
triangle(100, 400, 110, 330, 120, 400);
triangle(120, 400, 130, 330, 140, 400);
triangle(140, 400, 150, 330, 160, 400);
triangle(160, 400, 170, 330, 180, 400);
triangle(180, 400, 190, 330, 200, 400);
triangle(200, 400, 210, 330, 220, 400);
triangle(220, 400, 230, 330, 240, 400);
triangle(240, 400, 250, 330, 260, 400);
triangle(260, 400, 270, 330, 280, 400);
triangle(280, 400, 290, 330, 300, 400);
triangle(300, 400, 310, 330, 320, 400);
triangle(320, 400, 330, 330, 340, 400);
triangle(340, 400, 350, 330, 360, 400);
triangle(360, 400, 370, 330, 380, 400);
triangle(380, 400, 390, 330, 400, 400);
//fish
fill(236, 136, 173);
noStroke();
ellipse(x+200, y+200, 100, 60);
fill(236, 136, 173);
noStroke();
triangle(x+250, y+200, x+290, y+170, x+290, y+230);
fill(0,0,0);
noStroke();
ellipse(x+170, y+195, 10, 10);
//move the fish
x=map(mouseX,0, 400, -400, 400);
y=map(mouseY, 0, 400, -400, 400);
//bubbles
if (mouseIsPressed) {
fill(260);
noStroke();
ellipse(x+140, y+190, 15, 15,);
fill(260);
noStroke();
ellipse(x+125, y+160, 18, 18);
fill(260);
noStroke();
ellipse(x+120, y+130, 22, 22);
fill(260);
noStroke();
ellipse(x+100, y+110, 25, 25);
fill(260);
noStroke();
ellipse(x+90, y+70, 33, 33);
fill(260);
noStroke();
ellipse(x+97, y+30, 38, 38);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment