FaultInOurPong  1
startGame.GameController Class Reference

Classes

class  GameListener
 action listener for the game page
 
class  ModeListener
 action listener for the game mode page
 
class  TutorialListener
 action listener for the tutorial page
 
class  WelcomepageListener
 action listener for the welcome page
 

Public Member Functions

 GameController (GameView v, GameModel m)
 
void display ()
 sets the display More...
 
void checkGameOver ()
 checks whether the game ends More...
 

Private Attributes

GameView v
 
GameModel m
 
Welcome w
 
Mode mode
 
Tutorial tut
 
HashSet< String > keys = new HashSet<String>()
 
JFrame gameFrame
 
int frameWidth
 
PongGameDisplay gameDisplay
 
int velX =1
 
int padWidth
 
int bottomPadX
 
Ball b
 
Paddle paddle_player
 
int ballX
 
int scoreTop
 
int inset
 
final int SINGLE = 0
 
final int ADVANCE = 1
 
int gameMode
 
Ball bomb
 
int bombX
 
Player player
 
Player ai
 
Timer t
 
Timer record
 

Constructor & Destructor Documentation

§ GameController()

startGame.GameController.GameController ( GameView  v,
GameModel  m 
)

Obtain the window frame dimentions

Setups for ball in the Model

Setups for the bomb in the Model

Setups for the paddles in the Model

  • obtain paddle dimensions
  • initialize paddle positions for the player paddle
  • initialize paddle positions for the ai paddle

Setups for the players in the Model

  • initialize number of life for the player and the ai

Setups for the View

  • obtain windows from the view
  • add action listener for different windows

Member Function Documentation

§ checkGameOver()

void startGame.GameController.checkGameOver ( )

checks whether the game ends

check the number of life for both the player and the ai is 0.

  • If the number of life for the ai is 0, the player wins
  • If the number of life for the player is 0, the ai wins.

§ display()

void startGame.GameController.display ( )

sets the display

opens a window

Member Data Documentation

§ ADVANCE

final int startGame.GameController.ADVANCE = 1
private

§ ai

Player startGame.GameController.ai
private

§ b

Ball startGame.GameController.b
private

§ ballX

int startGame.GameController.ballX
private

§ bomb

Ball startGame.GameController.bomb
private

§ bombX

int startGame.GameController.bombX
private

§ bottomPadX

int startGame.GameController.bottomPadX
private

§ frameWidth

int startGame.GameController.frameWidth
private

§ gameDisplay

PongGameDisplay startGame.GameController.gameDisplay
private

§ gameFrame

JFrame startGame.GameController.gameFrame
private

Variable declarations for the game

  • frame dimension
  • paddle information
  • ball information
  • bomb information
  • player information

§ gameMode

int startGame.GameController.gameMode
private

§ inset

int startGame.GameController.inset
private

§ keys

HashSet<String> startGame.GameController.keys = new HashSet<String>()
private

Declare a variable for storing the key pressed records

§ m

GameModel startGame.GameController.m
private

§ mode

Mode startGame.GameController.mode
private

§ paddle_player

Paddle startGame.GameController.paddle_player
private

§ padWidth

int startGame.GameController.padWidth
private

§ player

Player startGame.GameController.player
private

§ record

Timer startGame.GameController.record
private

§ scoreTop

int startGame.GameController.scoreTop
private

§ SINGLE

final int startGame.GameController.SINGLE = 0
private

§ t

Timer startGame.GameController.t
private

§ tut

Tutorial startGame.GameController.tut
private

§ v

GameView startGame.GameController.v
private

Import model and view to the controller (this interface).

§ velX

int startGame.GameController.velX =1
private

§ w

Welcome startGame.GameController.w
private

Variable declarations for storing the game view windows

  • welcome page
  • mode page for showing different modes
  • tutorial page for giving instructions to the students

The documentation for this class was generated from the following file: