float x=50, y=50, t=3, s=2, m; int sphereSize, barHeight; void setup(){ size(500, 500, P3D); lights(); sphereSize = 10; barHeight = 100; } void draw() { background(255); m=mouseY; pushMatrix(); noStroke(); fill(255, 200, 200); translate(x, y, 0); sphere(sphereSize); popMatrix(); t=x>(width-5)||x<15&&ym-(barHeight/2)?-t:t; // x x=x(width-sphereSize)||y