class Ball {
  float x, y;
  float size;
  float speedX, speedY;

  // Constructor
  Ball(float x, float y, float size, float speedX, float speedY) {
    this.x = x;
    this.y = y;
    this.size = size;
    this.speedX = speedX;
    this.speedY = speedY;
  }

  // Show the ball
  void show() {
    circle(x, y, size);
  }

  // Move the ball
  void move() {
    x += speedX;
    y += speedY;
  }

  // Check if the ball hit the walls
  void checkWalls() {
    float radius = size / 2;

    // Check if the ball hit the left and right walls
    if (x > width - radius || x < radius) {
      speedX = -speedX;
    }

    // Check if the ball hit the top and bottom walls
    if (y > height - radius || y < radius) {
      speedY = -speedY;
    }
  }
}
