class Ball { float x, y; float xspeed, yspeed; color c; float r; Ball(float radius){ c = color(255, 166, 0); r = radius; x = random(width); y = random(height); xspeed = random(1, 5); yspeed = random(1, 5); } void move(){ x += xspeed; y += yspeed; if(x > width || x < 0) { xspeed *= -1; } if(y > height ||y < 0) { yspeed *= -1; } } void display() { fill(c); ellipse(x, y, r, r); }
}