class Ball {
float x;
float y;
float speedX;
float speedY;
float s;
Ball(float _x, float _y) {
x = _x;
y = _y;
speedX = random(-5, 5);
speedY = random(-5, 5);
s = random(5, 200);
}
void render() {
circle(x, y, s);
}
void update() {
x = x + speedX;
y = y + speedY;
}
void bounce() {
if (x>width || x<0) {
speedX = -speedX;
}
if (y>height || y<0) {
speedY = -speedY;
}
}
}