vooga.games.mariogame
Class GamePlayState

java.lang.Object
  extended by vooga.engine.state.GameState
      extended by vooga.games.mariogame.GamePlayState

public class GamePlayState
extends GameState


Nested Class Summary
static class GamePlayState.State
           
 
Field Summary
 
Fields inherited from class vooga.engine.state.GameState
myRenderField, myUpdateField
 
Constructor Summary
GamePlayState(Game game)
          This constructs a GamePlayState by initializing the player as well as the game dimensions.
 
Method Summary
 int getCurrentLevel()
           
 int getScore()
           
 void init()
          This method initializes all necessary variables, such as playfields, backgrounds, enemies, and tiles for the start of the game.
 GamePlayState.State nextState()
          This method is called in the MarioClone update method in order to check if any state transitions need to happen.
 void render(java.awt.Graphics2D g)
          Main render method that renders the backgrounds and playfield.
 void update(long t)
          This method is responsible for updating the main game playfield, which contains all of the game sprites.
 
Methods inherited from class vooga.engine.state.GameState
activate, addGroup, addPlayField, addRenderPlayField, addRenderState, addState, addUpdatePlayField, addUpdateState, deactivate, equals, getGroup, getRenderField, getUpdateField, initialize, isActive, removeEverything
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GamePlayState

public GamePlayState(Game game)
This constructs a GamePlayState by initializing the player as well as the game dimensions.

Parameters:
mario - is a MarioSprite, which represents the user controlled sprite.
width - is the desired width of the game window
height - is the desired height of the game window
Method Detail

nextState

public GamePlayState.State nextState()
This method is called in the MarioClone update method in order to check if any state transitions need to happen.

Returns:
This method returns one of three state types: win, loss, or continue, depending on the given game conditions.

update

public void update(long t)
This method is responsible for updating the main game playfield, which contains all of the game sprites.

Overrides:
update in class GameState
Parameters:
t - - the time constant that the engine uses for updating.

init

public void init()
This method initializes all necessary variables, such as playfields, backgrounds, enemies, and tiles for the start of the game.


getScore

public int getScore()

render

public void render(java.awt.Graphics2D g)
Main render method that renders the backgrounds and playfield.

Overrides:
render in class GameState

getCurrentLevel

public int getCurrentLevel()