FaultInOurPong  1
model.GameModel Class Reference

Public Member Functions

 GameModel ()
 Constructor for the game Model. More...
 
void setBall (int x, int y)
 sets the x and y positions of a ball More...
 
void setBomb (int x, int y)
 sets the x and y positions of a bomb More...
 
Ball getBall ()
 gets the Ball object More...
 
Ball getBomb ()
 gets the bomb object More...
 
Paddle getPlayerPaddle ()
 gets the user paddle object More...
 
Paddle getComputerPaddle ()
 gets the computer paddle object More...
 
Player getPlayer ()
 gets the player object More...
 
Player getComputer ()
 gets the computer object More...
 

Private Attributes

Ball b
 
Paddle p_player
 
Player player
 

Constructor & Destructor Documentation

§ GameModel()

model.GameModel.GameModel ( )

Constructor for the game Model.

Contains all the data and models for the game, including the player, paddle, and the ball.

Declara variables/instances for the model

  • regular ball
  • bomb
  • paddle for the player
  • paddle for the computer
  • score and life for the player
  • score and life for the ai

Member Function Documentation

§ getBall()

Ball model.GameModel.getBall ( )

gets the Ball object

Returns
b is the ball object

§ getBomb()

Ball model.GameModel.getBomb ( )

gets the bomb object

Returns
bomb is the bomb object

§ getComputer()

Player model.GameModel.getComputer ( )

gets the computer object

Returns
computer

§ getComputerPaddle()

Paddle model.GameModel.getComputerPaddle ( )

gets the computer paddle object

Returns
p_computer

§ getPlayer()

Player model.GameModel.getPlayer ( )

gets the player object

Returns
player

§ getPlayerPaddle()

Paddle model.GameModel.getPlayerPaddle ( )

gets the user paddle object

Returns
p_player

§ setBall()

void model.GameModel.setBall ( int  x,
int  y 
)

sets the x and y positions of a ball

Parameters
xis the x position of the ball
yis the y position of the ball
Exceptions
ArithmeticExceptionball position could not be set out of the game frame.

§ setBomb()

void model.GameModel.setBomb ( int  x,
int  y 
)

sets the x and y positions of a bomb

Parameters
xis the x position of the bomb
yis the y position of the bomb

Member Data Documentation

§ b

Ball model.GameModel.b
private

The ball object for the game

§ p_player

Paddle model.GameModel.p_player
private

The two paddle in the game, one for the player and the other for the computer

§ player

Player model.GameModel.player
private

The two players in the game, one for the user and the other for the computer


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