Bouncing Ball

[MONSTERFEST]

// bouncing ball

float ballSize = 100;
float speed = 1;
float ballx = 250;
float bally = ballSize/2;

void setup() {
  size(500, 600);
} //setup

void draw() {
  background(220);
  fill(80);
  ellipse(ballx, bally, ballSize, ballSize);
  speed = speed + 0.1;
  bally = bally + speed;

  if (bally > height - ballSize/2) {
    bally = height - ballSize/2;
    speed = -speed * 0.8;
  }
} //draw