var flagX = 570;
var color1 = 255;
var color2 = 150;
function setup() {
createCanvas(640, 480);
}
function draw() {
//grass
background(57,181,74);
//sky
fill(102,193,242);
ellipse(320,100,1300,400);
//cloud will move and change color relative to mouseX movement
push();
translate((width / 2) - mouseX, 0);
fill(mouseX - color2);
ellipse(370,100,80,80);
ellipse(450,60,100,100);
ellipse(400,60,60,60);
ellipse(520,100,90,90);
ellipse(450,100,100,100);
ellipse(565,120,50,50);
pop();
//text
push();
textSize(20);
fill(255,mouseX / 2,40);
text("IT'S IN THE HOLE!",mouseX-60,100);
pop() ;
//green
fill(141,198,63);
ellipse(450,400,400,90);
//hole
fill(0);
ellipse(520,400,25,15);
//flag pole
fill(225);
rect(518,200,4, 200);
//flag
fill(200,0,0);
triangle(522,200,522, 250, flagX,225) ;
//ball
fill(color1);
noStroke();
ellipse(mouseX,mouseY,(600 - mouseX) / 7,(600 - mouseX) / 7);
//flag will move when mouse gets close
if(mouseX > 0 & mouseX < 220) {
flagX = 474
}else(flagX = 570);
//ball disappears when it is on top of the hole
if(mouseX > 515 & mouseY < 525 &&
mouseY > 398 && mouseY < 402){
color1 = 0
}else(color1 = 255);
}
First let me explain the drawing I created. The whole golf theme came to me a bit randomly. I was very interested in the pong game we made, so for the dynamic drawing I wanted to make another game. It is supposed to simulate a golfball getting closer to the hole. Once the ball is over the hole it disappears.
The part I found hardest about this project was coming up with an idea. I feel pretty confident with the concepts but just couldn’t get myself to come up with an idea. Once I expanded my thought from just moving patterns, this is what I came up with.