vooga.engine.core
Class Game

java.lang.Object
  extended by com.golden.gamedev.Game
      extended by vooga.engine.core.Game
Direct Known Subclasses:
Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, Blah, ControlGameExample, DropThis, DropThis, DropThis, DropThis, DropThis, Example, Main, OldDropThisForReference, OverlayExample, ReachTheTop, StateGame, TicTacToe

public class Game
extends com.golden.gamedev.Game

Extension of the Golden T game to automate some Vooga API functionality.
initResources() automatically loads all resources associated with the resources.xml file in your game's resources package.
It also now has a built in GameStateManager which is automatically initialized in initResources. The initialization behavior can be changed by overriding initGameStates. The update and render methods call update and render for this GameStateManager.
The game also automatically loads the initial level using the Level XML parser
All subclasses should override initResources() and implement a main method that calls launch(). The initResources() method should first call super.initResources() and then initialize all the game states


Field Summary
protected  LevelParser levelParser
           
protected  PlayField myCurrentLevel
           
protected  GameState myPlayState
           
protected  GameStateManager stateManager
           
 
Constructor Summary
Game()
           
 
Method Summary
 GameState addGameState(GameState gameState)
          add a GameState to the stateManager to prevent repetitive calls to retrieve the stateManager to add to it in Game extensions
 PlayField getCurrentLevel()
          Returns the VoogaPlayField that is associated with the current level.
 GameStateManager getGameStateManager()
          get the GameStateManager for this game
 GameState getPlayGameState()
          this method gets the play game state
protected  java.lang.String getResourceXMLPath()
          Get the path for the resources package directory where the resources.xml file is
 void initGameStates()
          Initializes the GameStateManager.
 void initResources()
           
 void initSoundPlayer()
           
static void launch(Game g)
          Launches the game using default or given settings.
 void render(java.awt.Graphics2D g)
           
 void setAsPlayGameState(GameState state)
          This method sets the play game state
 void update(long elapsedTime)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stateManager

protected GameStateManager stateManager

levelParser

protected LevelParser levelParser

myCurrentLevel

protected PlayField myCurrentLevel

myPlayState

protected GameState myPlayState
Constructor Detail

Game

public Game()
Method Detail

initResources

public void initResources()

update

public void update(long elapsedTime)

render

public void render(java.awt.Graphics2D g)

initSoundPlayer

public void initSoundPlayer()

getCurrentLevel

public PlayField getCurrentLevel()
Returns the VoogaPlayField that is associated with the current level.


getPlayGameState

public GameState getPlayGameState()
this method gets the play game state

Returns:

setAsPlayGameState

public void setAsPlayGameState(GameState state)
This method sets the play game state

Parameters:
state -

initGameStates

public void initGameStates()
Initializes the GameStateManager. This should be overridden by subclasses which should call super() and then setup/add all necessary GameStates.


getGameStateManager

public GameStateManager getGameStateManager()
get the GameStateManager for this game

Returns:
GameStateManager object

addGameState

public GameState addGameState(GameState gameState)
add a GameState to the stateManager to prevent repetitive calls to retrieve the stateManager to add to it in Game extensions

Parameters:
gameState - GameState to add to the Game stateManager
Returns:
gameState added to reduce number of lines of code when adding GameStates

getResourceXMLPath

protected java.lang.String getResourceXMLPath()
Get the path for the resources package directory where the resources.xml file is

Returns:
the path for the resources directory

launch

public static void launch(Game g)
Launches the game using default or given settings. The game width, height, and fullscreen option are stored in a file called config.properties under the resources package. These values are extracted before the game is launched. Any subclass should call launch() in the main method

Parameters:
g -