Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- public class Ball {
- //add instance variables for the Ball class here
- int changeInX;
- int changeInY;
- Rectangle ballRect;
- public Ball() {
- this.changeInX = changeInX;
- this.changeInY = changeInY;
- Rectangle ballRect = new Rectangle(BreakOutConstants.BALL_START_RECT.x, BreakOutConstants.BALL_START_RECT.y);
- resetBall();
- }
- //-------------------------------------------------------------------
- //-------- RESETS THE BALL TO ITS INITIAL SETTINGS ------------------
- //-------------------------------------------------------------------
- private void resetBall() {
- ballRect.x = BreakOutConstants.BALL_START_RECT.x;
- ballRect.y = BreakOutConstants.BALL_START_RECT.y;
- }
- //------------------------------------------------------------
- //-------- DRAW THE BALL. ------------------------------------
- //------------------------------------------------------------
- public void drawBall(Graphics g) {
- g.setColor(Color.red);
- g.drawOval(ballRect.x, ballRect.y, BreakOutConstants.BALL_SIZE, BreakOutConstants.BALL_SIZE);
- }
- //-------------------------------------------------------------
- //-------- CHANGE THE POSITION OF THE BALL (Stage 4) ----------
- //-------------------------------------------------------------
- public void moveBall() {
- }
- }
Add Comment
Please, Sign In to add comment