/////how can I define other classes in eclipse PVector loc; int rectWidth = 50; PVector Eloc ; float theta = 0; PVector acc= new PVector(0,0); int r = 10; int k = 5; void setup(){ size(1200,500); loc = new PVector(200,height/2); frameRate(100); Eloc = new PVector(loc.x+(rectWidth/2),10); } void draw(){ background(0); loc.y = map(sin(theta),-1,1,50,10); theta += 0.1f; //loc.add(acc); Eloc.y+=k; smooth(); fill(255); rect(loc.x,height,rectWidth,-100+loc.y); fill(120,200,120); ellipse(Eloc.x,Eloc.y,r*2,r*2); float rectTop = height-100+loc.y; float circle = Eloc.y+r; if(circle>rectTop){ k=-5; } else if(circle<1){ k+=5; } }