Guest User

Untitled

a guest
Jun 19th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.31 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. public class Ball {
  4.  
  5.  //add instance variables for the Ball class here
  6.  int changeInX;
  7.  int changeInY;
  8.  Rectangle ballRect;
  9.  
  10.  public Ball() {
  11.  
  12.  this.changeInX = changeInX;
  13.  this.changeInY = changeInY;  
  14.  Rectangle ballRect = new Rectangle(BreakOutConstants.BALL_START_RECT.x, BreakOutConstants.BALL_START_RECT.y);
  15.  resetBall();
  16.  
  17.  }
  18.  
  19. //-------------------------------------------------------------------
  20. //-------- RESETS THE BALL TO ITS INITIAL SETTINGS ------------------
  21. //-------------------------------------------------------------------
  22.  private void resetBall() {
  23.  ballRect.x = BreakOutConstants.BALL_START_RECT.x;
  24.  ballRect.y = BreakOutConstants.BALL_START_RECT.y;
  25.  }
  26.  
  27. //------------------------------------------------------------
  28. //-------- DRAW THE BALL. ------------------------------------
  29. //------------------------------------------------------------  
  30.  public void drawBall(Graphics g) {
  31.     g.setColor(Color.red);
  32.     g.drawOval(ballRect.x, ballRect.y, BreakOutConstants.BALL_SIZE, BreakOutConstants.BALL_SIZE);
  33.  }
  34.  
  35. //-------------------------------------------------------------  
  36. //-------- CHANGE THE POSITION OF THE BALL (Stage 4) ----------
  37. //-------------------------------------------------------------  
  38.  public void moveBall() {
  39.  
  40.  }
  41.  
  42.  
  43. }
Add Comment
Please, Sign In to add comment