java.lang.Object | +--PongPaddle
This class describes objects that represent the paddles in a Pong game. Each PongPaddle has an (x,y) position that indicates the position of the top-left corner of the paddle. Each PongPaddle also has a width and a height.
Constructor Summary | |
PongPaddle(int top,
int left,
int w,
int h)
Construct a new PongPaddle at the specified position with the specified width and height. |
Method Summary | |
int |
getBottomY()
Return the Y coordinate of the bottom edge of this PongPaddle. |
int |
getLeftX()
Return the X coordinate of the left edge of this PongPaddle. |
int |
getRightX()
Return the X coordinate of the right edge of this PongPaddle. |
int |
getTopY()
Return the Y coordinate of the top edge of this PongPaddle. |
void |
moveDown(int d)
Move the position of this PongPaddle down by the specified number of pixels. |
void |
moveUp(int d)
Move the position of this PongPaddle up by the specified number of pixels. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public PongPaddle(int top, int left, int w, int h)
top
- the Y coordinate of the top left corner of the
new PongPaddle.left
- the X coordinate of the top left corner of the
new PongPaddle.w
- the width of the new PongPaddle, measured in pixels.h
- the height of the new PongPaddle, measured in pixels.Method Detail |
public int getBottomY()
public int getLeftX()
public int getRightX()
public int getTopY()
public void moveDown(int d)
d
- a number of pixels.public void moveUp(int d)
d
- a number of pixels.