//5-9 simple gravity, a square falls from the top of the screen and bounces float x = 100; float y = 0; float speed = 0; float gravity= 0.1; void setup () { size (200, 200); } void draw () { background (255); //display the square fill(0); noStroke(); rectMode(CENTER); rect(x,y,10,10); y= y + speed; speed = speed + gravity; //If square reaches the bottom //Reverse speed if (y > height) { speed = speed * -0.95; } }