java.lang.Object | +--PongBall
This class describes an object that is used to represent the ball in a game of pong. Each PongBall will have an x and y position. Each PongBall will also have a velocity in the x direction and a velocity in the y direction.
Constructor Summary | |
PongBall(int initX,
int initY,
int initXVel,
int initYVel)
Construct a new PongBall with the specified initial position and velocity. |
Method Summary | |
void |
bounceX()
Reverse the X direction of this PongBall. |
void |
bounceY()
Reverse the Y direction of this PongBall. |
int |
getX()
Return the current X position of this PongBall. |
int |
getY()
Return the current Y position of this PongBall. |
void |
move()
Move this PongBall according to its current velocity. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PongBall(int initX, int initY, int initXVel, int initYVel)
initX
- the initial X position of the new PongBall.initY
- the initial Y position of the new PongBall.initXVel
- the initial velocity of the new PongBall in
the X direction.initYVel
- the initial velocity of the new PongBall in
the Y Direction.Method Detail |
public void bounceX()
public void bounceY()
public int getX()
public int getY()
public void move()