org.deken.game.state
Class GameState

java.lang.Object
  extended by org.deken.game.state.GameState
All Implemented Interfaces:
Updateable
Direct Known Subclasses:
NullState

public abstract class GameState
extends java.lang.Object
implements Updateable

Title: GameState

Description: GameState is used for providing an over arching state of the game. The GameState is used to monitory the high level of the game and change it's state: The main playing state, the player wins the game, the player loses the game. In the update method you can define what will case the game to change state. The BaseGameCanvas has the current GameState. GameState

Copyright: Copyright (c) Apr 2, 2015

Version:
1.0
Author:
Gary Deken

Field Summary
protected  BaseGameCanvas gameCanvas
           
 
Constructor Summary
GameState()
           
 
Method Summary
abstract  void activateState()
          Activate this state, to setup any needed features for this state.
 void changeState(GameState newGameState)
          This method is called to change the game's state, by passing in the new state.
abstract  void deactivateState()
          This is called on when the changeState is called.
 void setGameCanvas(BaseGameCanvas baseGameCanvas)
           
abstract  void update(long elapseTime)
          This is called in the GameTimer's update phase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deken.game.Updateable
getName
 

Field Detail

gameCanvas

protected BaseGameCanvas gameCanvas
Constructor Detail

GameState

public GameState()
Method Detail

activateState

public abstract void activateState()
Activate this state, to setup any needed features for this state. This makes the GameState active. This is called from the GameCanvas' setGameState().


changeState

public final void changeState(GameState newGameState)
This method is called to change the game's state, by passing in the new state.

Parameters:
newGameState -

deactivateState

public abstract void deactivateState()
This is called on when the changeState is called. It is for any clean up of this state, including reseting this state to be activated later.


setGameCanvas

public final void setGameCanvas(BaseGameCanvas baseGameCanvas)

update

public abstract void update(long elapseTime)
This is called in the GameTimer's update phase. It is used to check the come user defined conditions and determine if the state should change.

Specified by:
update in interface Updateable
Parameters:
elapseTime -