§ 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
§ noBomb()
void view.PongGameDisplay.noBomb |
( |
| ) |
|
defines the game mode does not contain a bomb
set the flag for the advance to be false
§ 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 the bomb if the mode is the advance mode
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
-
§ setBomb()
void view.PongGameDisplay.setBomb |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
sets the positions of the bomb
- Parameters
-
x | is the x-position of the bomb |
y | is the y-position of the bomb |
§ setBottom()
void view.PongGameDisplay.setBottom |
( |
int |
x | ) |
|
sets x-position for the player paddle
- Parameters
-
§ setBottomPaddle()
void view.PongGameDisplay.setBottomPaddle |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
§ 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
-
§ setTopPaddle()
void view.PongGameDisplay.setTopPaddle |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
§ setTopScore()
void view.PongGameDisplay.setTopScore |
( |
int |
s | ) |
|
sets the score for ai
- Parameters
-
§ timeForBomb()
void view.PongGameDisplay.timeForBomb |
( |
| ) |
|
defines the game mode contains a bomb
set the flag for the advance to be true
§ ADVANCE
final int view.PongGameDisplay.ADVANCE =1 |
|
private |
§ ballSize
int view.PongGameDisplay.ballSize |
|
private |
§ ballX
int view.PongGameDisplay.ballX |
|
private |
§ bombX
int view.PongGameDisplay.bombX |
|
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 |
§ startBomb
boolean view.PongGameDisplay.startBomb |
|
private |
§ topPadX
int view.PongGameDisplay.topPadX |
|
private |
The documentation for this class was generated from the following file: