Ball ball1; Ball ball2; float gravity = 0.1; void setup(){ size(200,200); ball1 = new Ball(50,0,16); ball2 = new Ball(100,50,32); } void draw(){ background(100,150,20); ball1.display(); ball1.move(); ball2.display(); ball2.move(); } class Ball{ float x; float y; float d; float speed; Ball (float tempx, float tempy, float tempd){ x= tempx; y=tempy; d=tempd; speed=2; } void display(){ fill(100,30,250); noStroke(); smooth(); ellipse(x,y,d,d); } void move(){ y=y+speed; speed = gravity+speed; if(y>=height){ speed=speed*-0.95; } } }