§ PongGameDisplay()
view.PongGameDisplay.PongGameDisplay |
( |
| ) |
|
Constructor for PongGameDisplay.
Constructor by default set the game to single mode
§ bombTime()
boolean view.PongGameDisplay.bombTime |
( |
| ) |
|
checks if it should start displaying the bomb
- Returns
- startBomb
§ getBallSize()
int view.PongGameDisplay.getBallSize |
( |
| ) |
|
gets the size of the ball
- Returns
- ballSize
§ 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
§ getBombX()
int view.PongGameDisplay.getBombX |
( |
| ) |
|
gets the x-position of the bomb
- Returns
- bombX
§ getBombY()
int view.PongGameDisplay.getBombY |
( |
| ) |
|
gets the y-position of the bomb
- Returns
- bombY
§ getBottomScore()
int view.PongGameDisplay.getBottomScore |
( |
| ) |
|
gets the player score
- Returns
- scoreBottom
§ 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
§ getMode()
int view.PongGameDisplay.getMode |
( |
| ) |
|
gets the mode of the game
- Returns
- gameMode
§ getTopScore()
int view.PongGameDisplay.getTopScore |
( |
| ) |
|
gets the score of AI
- Returns
- scoreTop
§ 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 |
- Exceptions
-
ArithmeticException | ball position could not be out of the game frame |
§ setBallSize()
void view.PongGameDisplay.setBallSize |
( |
int |
s | ) |
|
sets the size of the ball
- Parameters
-
- Exceptions
-
ArithmeticException | ball size should not be less than zero |
§ 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 |
- Exceptions
-
ArithmeticException | bomb position could not be out of the game frame |
§ setBottom()
void view.PongGameDisplay.setBottom |
( |
int |
x | ) |
|
sets x-position for the player paddle
- Parameters
-
- Exceptions
-
ArithmeticException | paddle x-position could not be out of the game frame |
§ setBottomPaddle()
void view.PongGameDisplay.setBottomPaddle |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
sets the positions of the player paddle
- Parameters
-
x | is the x-position of the player paddle |
y | is the y-position of the player paddle |
- Exceptions
-
ArithmeticException | player paddle position could not be out of the game frame |
§ setBottomScore()
void view.PongGameDisplay.setBottomScore |
( |
int |
s | ) |
|
sets the score for player
- Parameters
-
- Exceptions
-
ArithmeticException | player score could not be less than zero |
§ setInset()
void view.PongGameDisplay.setInset |
( |
int |
i | ) |
|
sets the distance between frame and the paddle
- Parameters
-
- Exceptions
-
ArithmeticException | distance between paddle and frame could not be set out of the frame |
§ setPaddleHeight()
void view.PongGameDisplay.setPaddleHeight |
( |
int |
h | ) |
|
sets the height of the paddle
- Parameters
-
- Exceptions
-
ArithmeticException | paddle height could not be less than zero |
§ setPaddleWidth()
void view.PongGameDisplay.setPaddleWidth |
( |
int |
w | ) |
|
sets the width of the paddle
- Parameters
-
- Exceptions
-
ArithmeticException | paddle width could not be less than zero |
§ setTop()
void view.PongGameDisplay.setTop |
( |
int |
x | ) |
|
sets x-position for the ai paddle
- Parameters
-
- Exceptions
-
ArithmeticException | paddle y-position could not be out of the game frame |
§ setTopPaddle()
void view.PongGameDisplay.setTopPaddle |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
sets the positions of the AI paddle
- Parameters
-
x | is the x-position of the AI paddle |
y | is the y-position of the AI paddle |
- Exceptions
-
ArithmeticException | ai paddle position could not be out of the game frame |
§ setTopScore()
void view.PongGameDisplay.setTopScore |
( |
int |
s | ) |
|
sets the score for ai
- Parameters
-
- Exceptions
-
ArithmeticException | ai score could not be less than zero |
§ 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: