xxxxxxxxxx
27
let locationY = 30;
let speedY = 0;
let gravity = 0.2;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(255, 204, 0);
fill(0, 204, 255);
noStroke();
translate(width/2, locationY);
ellipse(0, 0, 40, 40);
locationY += speedY;
speedY += gravity;
if ((locationY >= height)) {
speedY = speedY * -0.75;
locationY = height;
}
}
function mousePressed(){
locationY = 30;
speedY = 0;
gravity = 0.2;
}