public class PongGame
extends java.lang.Object
Constructor and Description |
---|
PongGame()
Constructs an instance of the PongGame.
|
Modifier and Type | Method and Description |
---|---|
void |
ballOffScreenLeft()
A STENCIL method called whenever the ball moves off the screen on the left side.
|
void |
ballOffScreenRight()
A STENCIL method called whenever the ball moves off the screen on the right side.
|
void |
checkWinner(int leftScore,
int rightScore)
A SUPPORT method that checks if any player has won the game.
|
void |
eachSecond()
A STENCIL method called throughout the game (actually every few milliseconds)
to update the state of the game.
|
void |
onDownPressed()
A STENCIL method called whenever the Down key is pressed - the right paddle
should move down.
|
void |
onSPressed()
A STENCIL method called whenever the S key is pressed - the left paddle
should move down.
|
void |
onUpPressed()
A STENCIL method called whenever the Up key is pressed - the right paddle
should move up.
|
void |
onWPressed()
A STENCIL method called whenever the W key is pressed - the left paddle
should move up.
|
void |
updateScoreLabels(int leftScore,
int rightScore)
A SUPPORT method that updates the score labels.
|
public PongGame()
public void ballOffScreenLeft()
public void ballOffScreenRight()
public void checkWinner(int leftScore, int rightScore)
leftScore
- the left player's scorerightScore
- the right player's scorepublic void eachSecond()
public void onDownPressed()
public void onSPressed()
public void onUpPressed()
public void onWPressed()
public void updateScoreLabels(int leftScore, int rightScore)
leftScore
- the left player's scorerightScore
- the right player's score