§ PongGameDisplay()
view.PongGameDisplay.PongGameDisplay |
( |
| ) |
|
Constructor for PongGameDisplay.
Constructor by default set the game to single mode
§ getBallX()
int view.PongGameDisplay.getBallX |
( |
| ) |
|
gets the x-position of the ball
- Returns
- ballX
§ getBallY()
int view.PongGameDisplay.getBallY |
( |
| ) |
|
gets the y-position of the ball
- Returns
- ballY
§ getBottomX()
int view.PongGameDisplay.getBottomX |
( |
| ) |
|
gets the x-position of the player paddle
- Returns
- bottomPadX
§ getBottomY()
int view.PongGameDisplay.getBottomY |
( |
| ) |
|
gets the y-position of the player paddle
- Returns
- bottomPadY
§ paintComponent()
void view.PongGameDisplay.paintComponent |
( |
Graphics |
g | ) |
|
|
protected |
draws shapes on the screen
when the game is started, by default draws the ball and paddles in the middle, otherwise, draws objects by passed in values.
Initial positioning
- ball at the center of the screen
- paddle in the middle of the frame width
Draw rectangles by passed in values
Draw the ball by passed in values
Draw scores on the screen by passed in values
§ setAdvance()
void view.PongGameDisplay.setAdvance |
( |
| ) |
|
sets the game mode to be advanced
set the flag to advance
§ setBall()
void view.PongGameDisplay.setBall |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
sets the positions of the ball
- Parameters
-
x | is the x-position of the ball |
y | is the y-position of the ball |
§ setBallSize()
void view.PongGameDisplay.setBallSize |
( |
int |
s | ) |
|
sets the size of the ball
- Parameters
-
§ setBottom()
void view.PongGameDisplay.setBottom |
( |
int |
x | ) |
|
sets x-position for the player paddle
- Parameters
-
§ setBottomScore()
void view.PongGameDisplay.setBottomScore |
( |
int |
s | ) |
|
sets the score for player
- Parameters
-
§ setInset()
void view.PongGameDisplay.setInset |
( |
int |
i | ) |
|
sets the distance between frame and the paddle
- Parameters
-
§ setPaddleHeight()
void view.PongGameDisplay.setPaddleHeight |
( |
int |
h | ) |
|
sets the height of the paddle
- Parameters
-
§ setPaddleWidth()
void view.PongGameDisplay.setPaddleWidth |
( |
int |
w | ) |
|
sets the width of the paddle
- Parameters
-
§ setTop()
void view.PongGameDisplay.setTop |
( |
int |
x | ) |
|
sets x-position for the ai paddle
- Parameters
-
§ setTopScore()
void view.PongGameDisplay.setTopScore |
( |
int |
s | ) |
|
sets the score for ai
- Parameters
-
§ ADVANCE
final int view.PongGameDisplay.ADVANCE =1 |
|
private |
§ ballSize
int view.PongGameDisplay.ballSize |
|
private |
§ ballX
int view.PongGameDisplay.ballX |
|
private |
§ bottomPadX
int view.PongGameDisplay.bottomPadX |
|
private |
§ first
boolean view.PongGameDisplay.first |
|
private |
§ frameHeight
int view.PongGameDisplay.frameHeight |
|
private |
§ frameWidth
int view.PongGameDisplay.frameWidth |
|
private |
Variable declarations for the display
- frame dimension
- ball information
- bomb information
- player scores
- paddle information
§ gameMode
int view.PongGameDisplay.gameMode |
|
private |
§ inset
int view.PongGameDisplay.inset |
|
private |
§ padW
int view.PongGameDisplay.padW |
|
private |
§ scoreTop
int view.PongGameDisplay.scoreTop |
|
private |
§ SINGLE
final int view.PongGameDisplay.SINGLE =0 |
|
private |
§ topPadX
int view.PongGameDisplay.topPadX |
|
private |
The documentation for this class was generated from the following file: