float velx,vely; float posx,posy; float grav; float rad; void setup() { size(600,600); noStroke(); smooth(); rad = 15; posx = 25; posy = 25; velx = 15; vely = 0; } void draw() { fill(0,40); rect(0,0,width,height); //warning : pseudo science posx += velx; posy += vely; velx *= .99; vely *= .99; if(posy+rad <= height-1){ vely += .6; } if(posy+rad > height||posy-rad <0){ posy = height-rad; vely *=-.8; println("bounce"); } if(posx+rad > width||posx-rad <0){ //posx = width-rad; velx *=-.8; println("bounce"); } fill(255); ellipse(posx,posy,rad,rad); }