edu.gatech.cs2335.lemmings.engine
Class GamePlayState

java.lang.Object
  extended byedu.gatech.cs2335.lemmings.engine.AbstractGameState
      extended byedu.gatech.cs2335.lemmings.engine.GamePlayState
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener
Direct Known Subclasses:
AttractState, MultiplayerGameplayState

public class GamePlayState
extends AbstractGameState

The game state, where the actual game is displayed and played.

Version:
1.0
Author:
Vladimir Urazov

Field Summary
static long UPDATE_DELAY
          Delay between the updates.
static float UPDATE_FREQUENCY
          How many times per second should we update the lemmings?
 
Constructor Summary
GamePlayState(Level l)
          Creates a new GamePlayState instance.
GamePlayState(java.lang.String levelName)
          Loads the level with the id passed in and uses that to play.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent ae)
          This function essentially processes the action event that may have been thrown by the UI.
 boolean cleanUp()
          This method will perform all of the necessary clean up operations once the object is no longer needed.
 void endLevel()
          Ends the level and goes on to the next state.
 GamePlayPanel getGamePlayPanel()
          accessor for gpp
protected  int getGameSpeed()
          Describe getGameSpeed method here.
protected  int getLemmingFlow()
          Describe getLemmingFlow method here.
 Level getLevel()
          Access method for the level property.
protected  LToggleButton getPauseButton()
          Describe getPauseButton method here.
protected  void handleDecreaseButton()
          Handles it when the decrease button is pressed.
protected  void handleIncreaseButton()
          Handles it when the increase button is pressed.
protected  void handleNukeButton()
          Handles it when the nuke button is pressed.
protected  void handlePauseButton()
          Handles it when the pause button is pressed.
protected  void handleSpeedupButton()
          Handles it when the speedup button is pressed.
 boolean initialize()
          This method will initialize the state that it belongs to.
protected  boolean isPauseSelected()
          Describe isPauseSelected method here.
 void setGameSpeed(long speed)
          This method will set the gamespeed;
protected  void singleDecreaseButtonHandle()
          Describe singleDecreaseButtonHandle method here.
protected  void singleIncreaseButtonHandle()
          Describe singleIncreaseButtonHandle method here.
protected  void singleNukeButtonHandle()
          Describe singleNukeButtonHandle method here.
protected  void singlePauseButtonHandle()
          Describe singlePauseButtonHandle method here.
protected  void singleSpeedupButtonHandle()
          Describe singleSpeedupButtonHandle method here.
protected  void specialDecreaseHandle()
          Whatever else needs to be done for decrease.
protected  void specialIncreaseHandle()
          Whatever else needs to be done for increase.
protected  void specialInitialize()
          Whatever else needs to be initialized.
protected  void specialNukeHandle()
          Whatever else needs to be done for nuke.
protected  void specialPauseHandle()
          Whatever else needs to be done for pause.
protected  void specialSpeedupHandle()
          Whatever else needs to be done for speedup.
protected  void specialUpdate()
          Handles the special update.
protected  void updateStuff()
          Describe updateStuff method here.
 
Methods inherited from class edu.gatech.cs2335.lemmings.engine.AbstractGameState
getUI, setUI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UPDATE_FREQUENCY

public static final float UPDATE_FREQUENCY
How many times per second should we update the lemmings?

See Also:
Constant Field Values

UPDATE_DELAY

public static final long UPDATE_DELAY
Delay between the updates.

See Also:
Constant Field Values
Constructor Detail

GamePlayState

public GamePlayState(Level l)
Creates a new GamePlayState instance.

Parameters:
l - The level that we would like to play on.

GamePlayState

public GamePlayState(java.lang.String levelName)
Loads the level with the id passed in and uses that to play.

Parameters:
levelName - a String value
Method Detail

getLevel

public Level getLevel()
Access method for the level property.

Returns:
the current value of the level property

initialize

public boolean initialize()
This method will initialize the state that it belongs to. It will then return true upon success, and false upon failure.

Specified by:
initialize in class AbstractGameState
Returns:
boolean

specialInitialize

protected void specialInitialize()
Whatever else needs to be initialized.


updateStuff

protected void updateStuff()
Describe updateStuff method here.


specialUpdate

protected void specialUpdate()
Handles the special update.


cleanUp

public boolean cleanUp()
This method will perform all of the necessary clean up operations once the object is no longer needed.

Specified by:
cleanUp in class AbstractGameState
Returns:
boolean

setGameSpeed

public void setGameSpeed(long speed)
This method will set the gamespeed;

Parameters:
speed - for gamespeed

endLevel

public void endLevel()
Ends the level and goes on to the next state.


handlePauseButton

protected void handlePauseButton()
Handles it when the pause button is pressed.


singlePauseButtonHandle

protected void singlePauseButtonHandle()
Describe singlePauseButtonHandle method here.


getPauseButton

protected LToggleButton getPauseButton()
Describe getPauseButton method here.

Returns:
a LToggleButton value

specialPauseHandle

protected void specialPauseHandle()
Whatever else needs to be done for pause.


handleSpeedupButton

protected void handleSpeedupButton()
Handles it when the speedup button is pressed.


singleSpeedupButtonHandle

protected void singleSpeedupButtonHandle()
Describe singleSpeedupButtonHandle method here.


specialSpeedupHandle

protected void specialSpeedupHandle()
Whatever else needs to be done for speedup.


handleNukeButton

protected void handleNukeButton()
Handles it when the nuke button is pressed.


singleNukeButtonHandle

protected void singleNukeButtonHandle()
Describe singleNukeButtonHandle method here.


specialNukeHandle

protected void specialNukeHandle()
Whatever else needs to be done for nuke.


handleIncreaseButton

protected void handleIncreaseButton()
Handles it when the increase button is pressed.


singleIncreaseButtonHandle

protected void singleIncreaseButtonHandle()
Describe singleIncreaseButtonHandle method here.


specialIncreaseHandle

protected void specialIncreaseHandle()
Whatever else needs to be done for increase.


handleDecreaseButton

protected void handleDecreaseButton()
Handles it when the decrease button is pressed.


singleDecreaseButtonHandle

protected void singleDecreaseButtonHandle()
Describe singleDecreaseButtonHandle method here.


specialDecreaseHandle

protected void specialDecreaseHandle()
Whatever else needs to be done for decrease.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent ae)
This function essentially processes the action event that may have been thrown by the UI.

Parameters:
ae - ae

isPauseSelected

protected boolean isPauseSelected()
Describe isPauseSelected method here.

Returns:
a boolean value

getGameSpeed

protected int getGameSpeed()
Describe getGameSpeed method here.

Returns:
an int value

getLemmingFlow

protected int getLemmingFlow()
Describe getLemmingFlow method here.

Returns:
an int value

getGamePlayPanel

public GamePlayPanel getGamePlayPanel()
accessor for gpp

Returns:
GamePlayPanel