fang
Class GameRedirection

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by javax.swing.JApplet
                      extended by fang.GameWindow
                          extended by fang.FrameAdvancer
                              extended by fang.GameLoop
                                  extended by fang.GameRedirection
All Implemented Interfaces:
AlarmScheduler, ActionListener, WindowStateListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer
Direct Known Subclasses:
Game

public abstract class GameRedirection
extends GameLoop

This class redirects all method calls to the originally extended JApplet.

Author:
Jam Jenkins and the FANG Team
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  boolean finishingGame
           
protected  Game firstGame
           
protected  boolean restarting
           
 
Fields inherited from class fang.GameLoop
client, player, random, SEED
 
Fields inherited from class fang.FrameAdvancer
canvas, timeInterval
 
Fields inherited from class fang.GameWindow
cards, connectButton, container, createOwnFrame, displayControlButtons, frame, fullScreen, help, helpPlay, loadingMessage, mute, pause, players, playersSelectable, playersSpinner, quit, serverField, serverLabel, serverSelectable, sessionComboBox, sessionLabel, sessionSelectable, title
 
Fields inherited from class javax.swing.JApplet
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GameRedirection(Dimension gameDimensions, Color backgroundColor)
          Constructs a game level; permits creation of a container of game levels and linking of the finish of one game to the beginning of another game/level.
 
Method Summary
 void addGame(Game game)
          Add a game to the list of games waiting to be played.
 void addLevel(GameLevel level)
          Deprecated.  
abstract  void advance()
           
 void advance(double secondsElapsed)
           
 void advanceFrame(double secondsElapsed)
          Deprecated.  
 void advanceLevel()
          Deprecated.  
 void begin()
          starts session by connecting to the server
 void cancel(TimedAction action)
           
 void cancelAlarm(Alarm alarm)
          removes all pending alarms on this object.
 void cancelAllAlarms()
          removes all pending alarms.
 void cancelAllTimedActions()
           
 void cleanUp()
          this method will be called by the FANG Engine just before terminating the level in case the level needs an opportunity to perform some final operations
 void connect(String server, String gameName, String sessionName, int players)
          connects to the server and sets the game and session name and sets the number of players
protected  void copyFirstFields()
           
protected  void copyFrom(Game game)
           
 void disconnect()
          disconnects from server.
 void finishGame()
          Finish the game.
 void finishLevel()
          Deprecated.  
 boolean gameIsOver()
          determines if the game is over.
 Alarm[] getAlarms()
          gets the list of alarms scheduled to go off in the future.
 TimedAction[] getAllTimedActions()
           
 AnimationCanvas getCanvas()
          returns the canvas
static Game getCurrentGame()
          Get a reference to the current game without having to know anything about the type of the game.
 String getGameName()
          gets the name of this game which by default is the name of the class
 int getID()
          gets the index of the current player.
 int getLevelNumber()
          Deprecated.  
 GameLevel getNextLevel()
          Deprecated.  
 int getNumberOfPlayers()
          gets the number of connected players in this game.
 Player getPlayer()
          gets the current player object.
 Player getPlayer(int playerIndex)
          gets the player object for a given player number.
 Player getPlayer(String name)
          gets the player object for a given player name.
 double getScreenRefreshRate()
          returns the screen refresh rate
 String getServerName()
          gets the name of the server.
 String getSessionName()
          gets the name of the session.
 double getTime()
          returns the current time in seconds since the beginning of this game.
 void initializePersistantState(Alarm[] alarms, Sprite[] sprites, Sound[] sounds)
          copies all of the peristent alarms, sprites, and sounds into this level's persistence collections
 boolean isGameOver()
           
 boolean isMuted()
          returns true if muted, false if not muted
 boolean isPaused()
          returns true if paused, false if the game is running
 void muteSound()
          turns the sound off
 void pause()
          temporarily stops the game from running
protected  void pauseToggle()
          changes between paused and unpaused
 void persist(Alarm alarm)
          adds an alarm to the collection of alarms which will persist after the level ends.
 void persist(Sound sound)
          adds a sound to the collection of sounds which will persist after the level ends.
 void persist(Sprite sprite)
          adds a sprite to the collection of sprites which will persist after the level ends.
 void playSound()
          turns sound on
 void playSoundImmediately()
          makes the game sound audible
protected  void reallyFinishGame()
           
protected  void reallyStartOver()
           
 void refreshScreen()
          updates the AnimationCanvas, should only be called from the AWTEvent Thread.
 void removeCursor()
          removes the cursor from the game canvas
protected  void removeLevelObjects()
          removes all the non-persistent sprites, alarms, and sounds
 void resetTime()
          makes the current time zero
 void restoreCursor()
          adds the default cursor back to the screen
 void resume()
          makes the game time start running after being paused
 void runAsApplication()
          runs as an application.
 void schedule(TimedAction action, double delay)
           
 void scheduleAbsolute(Alarm alarm, double absolute)
          sets and alarm to go off at a time relative to the beginning of time (zero).
 void scheduleRelative(Alarm alarm, double relative)
          sets and alarm to go off relative to the current time.
 void sendMessage(Object localMessage)
          sends a message to all of the clients
 void serverSaysPauseToggle()
          changes the display between pause/resume when a pause message is sent from the server.
 void setCanvas(AnimationCanvas canvas)
          set canvas to a new canvas
 void setCursor(URL url)
          sets the cursor for the game engine
 void setGameName(String gameName)
          sets the name of the game.
 void setGameOver(boolean gameOver)
          sets the game state to gameOver.
 void setHelp(String filename)
          this method must be called in order to set the help screen.
 void setHelpText(String helpText)
           
 void setMinimumModelFrameRate(int framesPerSecond)
          sets the minimum number of frames which must be computed per second.
 void setNextLevel(GameLevel level)
          Deprecated.  
 void setNumberOfPlayers(int numPlayers)
          sets the number of players.
 void setServerName(String server)
          sets the name of the server.
 void setSessionName(String sessionName)
          sets the name of the session.
 void setTitle(String topTitle)
          Sets the title at the top of the JFrame and/or applet
abstract  void setup()
           
 void startGame()
          starts game.
 void startGameImmediately()
          makes the game start immediately when loaded
 void startOver()
          starts the game over.
 void stop()
          disconnects from the server and stops the advancing of frames.
protected  void toggleAudible()
          Deprecated. use of this method is depricated; use toggleSound instead
 void togglePause()
           
 void toggleSound()
          switches between mute and audible
 void updateModel(double time)
          updates the model between displays.
 
Methods inherited from class fang.GameLoop
getGameOverLevel, getGameResource, getResource, main, postAdvanceFrame
 
Methods inherited from class fang.FrameAdvancer
setBackground
 
Methods inherited from class fang.GameWindow
actionPerformed, getDefaultSize, getHash, getHelpStyleSheet, getHostname, init, isCreatingOwnFrame, setCreateOwnFrame, setDefaultHelp, setLoadMessage, windowStateChanged
 
Methods inherited from class javax.swing.JApplet
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

firstGame

protected Game firstGame

finishingGame

protected boolean finishingGame

restarting

protected boolean restarting
Constructor Detail

GameRedirection

public GameRedirection(Dimension gameDimensions,
                       Color backgroundColor)
Constructs a game level; permits creation of a container of game levels and linking of the finish of one game to the beginning of another game/level.

Parameters:
gameDimensions - the dimensions, in pixels, of the game canvas part of the game window. The play area size.
backgroundColor - color to wipe the backtground to
Method Detail

copyFirstFields

protected void copyFirstFields()

getCurrentGame

public static Game getCurrentGame()
Get a reference to the current game without having to know anything about the type of the game. Note: this method must only be called from the AWT Event Thread.

Returns:
a reference to the current game, or null if not called from the AWT Event Thread

addGame

public void addGame(Game game)
Add a game to the list of games waiting to be played.

Parameters:
game - the Game to add to the end of the list of upcoming games

finishGame

public void finishGame()
Finish the game. advance and advanceFrame will not be called again for this GameRedirection. Note that any games added (through calls to addGame) are, at this point, added to the upcomingGames and removed from addedGames.


reallyFinishGame

protected void reallyFinishGame()

addLevel

public final void addLevel(GameLevel level)
Deprecated. 

Add a level. This method should not be used; use fang.core.addGame instead.

Overrides:
addLevel in class GameLoop
Parameters:
level - the game level to add to the list of levels to execute in order

finishLevel

public final void finishLevel()
Deprecated. 

Finish a level. This method should not be used; use fang.core.finishGame instead.

Overrides:
finishLevel in class GameLoop

getNextLevel

public final GameLevel getNextLevel()
Deprecated. 

Get the next game level. This method should not be used; use

Overrides:
getNextLevel in class GameLoop
Returns:
the next level to begin. Returning null signals game over, and the getGameOver level will be called

advanceLevel

public final void advanceLevel()
Deprecated. 

Description copied from class: GameLoop
advances to the next level by clearing all of the non-persistent state and getting the next level to execute.

Overrides:
advanceLevel in class GameLoop

getLevelNumber

public final int getLevelNumber()
Deprecated. 

Description copied from class: GameLoop
gets the current level number. If not using levels, a negative number is returned.

Overrides:
getLevelNumber in class GameLoop
Returns:
the index of the current level, or a negative number if levels are not being used.

setNextLevel

public final void setNextLevel(GameLevel level)
Deprecated. 

Description copied from class: GameLoop
dynamically sets the next level to be executed in the game. Only the last call to this method will be used in determining which level will be executed after the current level ends. If you want the game to advances through a sequence of levels set out at the beginning of the game, use addLevel instead. Do not use both addLevel and setNextLevel in any one game.

Overrides:
setNextLevel in class GameLoop
Parameters:
level - the game level to insert into the list of levels to execute

advanceFrame

public final void advanceFrame(double secondsElapsed)
Deprecated. 

Description copied from class: GameLoop
This method is where the game logic will be applied. In general the game will respond to user input and other events such as sprite collisions. This method is called for you by the FANG Engine and should not be called directly.

Overrides:
advanceFrame in class GameLoop
Parameters:
secondsElapsed - the duration of time which has passed since the last frame was calculated or displayed.

advance

public void advance(double secondsElapsed)

advance

public abstract void advance()

removeLevelObjects

protected void removeLevelObjects()
removes all the non-persistent sprites, alarms, and sounds


startOver

public void startOver()
starts the game over. This consists of removing all the sprites, sounds, and alarms, then calling the startGame method. All of this will occur after the next termination of the advanceFrame method. Therefore, the game should be able to continue without error for at least one more frame before the startGame method is called.

Overrides:
startOver in class GameLoop

reallyStartOver

protected void reallyStartOver()

cleanUp

public void cleanUp()
this method will be called by the FANG Engine just before terminating the level in case the level needs an opportunity to perform some final operations


persist

public void persist(Alarm alarm)
adds an alarm to the collection of alarms which will persist after the level ends.

Parameters:
alarm - the alarm to keep after the level terminates

persist

public void persist(Sprite sprite)
adds a sprite to the collection of sprites which will persist after the level ends.

Parameters:
sprite - the sprite to keep after the level terminates

persist

public void persist(Sound sound)
adds a sound to the collection of sounds which will persist after the level ends.

Parameters:
sound - the sound to keep after the level terminates

initializePersistantState

public void initializePersistantState(Alarm[] alarms,
                                      Sprite[] sprites,
                                      Sound[] sounds)
copies all of the peristent alarms, sprites, and sounds into this level's persistence collections

Parameters:
alarms - the alarms which came from the last level
sprites - the sprites which came from the last level
sounds - the sounds which came from the last lelel

setup

public abstract void setup()

startGame

public final void startGame()
Description copied from class: GameLoop
starts game. At this point the number of players is now known. This method should create and add sprites to the canvas. This method is called for you by the FANG Engine and should not be called directly.

Overrides:
startGame in class GameLoop

copyFrom

protected void copyFrom(Game game)

toggleSound

public final void toggleSound()
Description copied from class: GameLoop
switches between mute and audible

Overrides:
toggleSound in class GameLoop

toggleAudible

@Deprecated
protected final void toggleAudible()
Deprecated. use of this method is depricated; use toggleSound instead

toggle mute/audible

Overrides:
toggleAudible in class GameLoop

isMuted

public boolean isMuted()
Description copied from class: GameLoop
returns true if muted, false if not muted

Overrides:
isMuted in class GameLoop
Returns:
WhetherMuted

muteSound

public void muteSound()
Description copied from class: GameLoop
turns the sound off

Overrides:
muteSound in class GameLoop

playSound

public void playSound()
Description copied from class: GameLoop
turns sound on

Overrides:
playSound in class GameLoop

pause

public void pause()
Description copied from class: GameLoop
temporarily stops the game from running

Overrides:
pause in class GameLoop

resume

public void resume()
Description copied from class: GameLoop
makes the game time start running after being paused

Overrides:
resume in class GameLoop

startGameImmediately

public void startGameImmediately()
Description copied from class: GameLoop
makes the game start immediately when loaded

Overrides:
startGameImmediately in class GameLoop

playSoundImmediately

public void playSoundImmediately()
Description copied from class: GameLoop
makes the game sound audible

Overrides:
playSoundImmediately in class GameLoop

begin

public void begin()
Description copied from class: GameLoop
starts session by connecting to the server

Overrides:
begin in class GameLoop

setServerName

public final void setServerName(String server)
Description copied from class: GameLoop
sets the name of the server. This is the domain name of the server to which the game will connect when starting.

Overrides:
setServerName in class GameLoop
Parameters:
server - the domain name of the gaming server to which this game will connect

setSessionName

public final void setSessionName(String sessionName)
Description copied from class: GameLoop
sets the name of the session. This is the name of the session which must match with all players in a multi-player game. The name of the session must be agreed upon before players can connect to each other.

Overrides:
setSessionName in class GameLoop
Parameters:
sessionName - the name of the session used to connect with other players

getSessionName

public String getSessionName()
Description copied from class: GameLoop
gets the name of the session. This is the name of the session which must match with all players in a multi-player game. The name of the session must be agreed upon before players can connect to each other.

Overrides:
getSessionName in class GameLoop
Returns:
the name of the session used to connect with other players

getServerName

public String getServerName()
Description copied from class: GameLoop
gets the name of the server. This is the domain name of the server to which the game will connect when starting.

Overrides:
getServerName in class GameLoop
Returns:
the domain name of the gaming server to which this game will/has connected

setGameName

public final void setGameName(String gameName)
Description copied from class: GameLoop
sets the name of the game. The name of the game is used in conjunction with the session name to help connect players to each other. To play in the same multi- player game, the game name and session name must match when connecting to the server

Overrides:
setGameName in class GameLoop
Parameters:
gameName - the name of this game

getGameName

public String getGameName()
Description copied from class: GameLoop
gets the name of this game which by default is the name of the class

Overrides:
getGameName in class GameLoop
Returns:
the name of the game. The name of the game is used in conjunction with the session name to help connect players to each other. To play in the same multi- player game, the game name and session name must match when connecting to the server

setNumberOfPlayers

public final void setNumberOfPlayers(int numPlayers)
Description copied from class: GameLoop
sets the number of players. This method is only used when the first person of a multi-player game connects to the server. For all players connecting to the same game session, all that is required is that the number of players be greater than 1. The person to start the session decides how many players to wait for before beginning the game.

Overrides:
setNumberOfPlayers in class GameLoop
Parameters:
numPlayers - the number of players to wait for before starting the game.

getNumberOfPlayers

public int getNumberOfPlayers()
Description copied from class: GameLoop
gets the number of connected players in this game. This method may only be called once the gaming engine has called the startGame method.

Overrides:
getNumberOfPlayers in class GameLoop
Returns:
the number of players who originally connected to the game

sendMessage

public void sendMessage(Object localMessage)
Description copied from class: GameLoop
sends a message to all of the clients

Overrides:
sendMessage in class GameLoop
Parameters:
localMessage - a Serializable message which is sent to all clients

connect

public final void connect(String server,
                          String gameName,
                          String sessionName,
                          int players)
Description copied from class: GameLoop
connects to the server and sets the game and session name and sets the number of players

Overrides:
connect in class GameLoop
Parameters:
server - the name of the domain which hosts the gaming server
gameName - the name of this game which is used for determining which players to connect to
sessionName - the name of this particular session of the game. Both the game name and session name must match when connecting to a group of players.
players - how many players to wait for before connecting

stop

public final void stop()
Description copied from class: GameLoop
disconnects from the server and stops the advancing of frames. This method permanently stops the game.

Overrides:
stop in class GameLoop

disconnect

public final void disconnect()
Description copied from class: GameLoop
disconnects from server. This method permanently stops the game.

Overrides:
disconnect in class GameLoop

isPaused

public boolean isPaused()
Description copied from class: GameLoop
returns true if paused, false if the game is running

Overrides:
isPaused in class GameLoop
Returns:
the state of the game running/paused

togglePause

public final void togglePause()
Overrides:
togglePause in class GameLoop

pauseToggle

protected final void pauseToggle()
Description copied from class: GameLoop
changes between paused and unpaused

Overrides:
pauseToggle in class GameLoop

serverSaysPauseToggle

public final void serverSaysPauseToggle()
Description copied from class: GameLoop
changes the display between pause/resume when a pause message is sent from the server. This method should not be called by any other class than the Client.

Overrides:
serverSaysPauseToggle in class GameLoop

getID

public int getID()
Description copied from class: GameLoop
gets the index of the current player. This index is the one that corresponds to the playerMouse, keyboard and messages arrays. This method should not be called before the gaming engine calls the startGame method.

Overrides:
getID in class GameLoop
Returns:
the index of the player

getPlayer

public Player getPlayer(int playerIndex)
Description copied from class: GameLoop
gets the player object for a given player number.

Overrides:
getPlayer in class GameLoop
Parameters:
playerIndex - the player number. See getNumberOfPlayers to determine how many players are connected to this game.
Returns:
the Player object which contains that user's keyboard, mouse, and any messages sent

getPlayer

public Player getPlayer(String name)
Description copied from class: GameLoop
gets the player object for a given player name.

Overrides:
getPlayer in class GameLoop
Parameters:
name - String name associated with the Player
Returns:
the Player object which contains that user's keyboard, mouse, and any messages sent

gameIsOver

public final boolean gameIsOver()
Description copied from class: GameLoop
determines if the game is over. When the game is over, the game over level (if there is one) is currently running.

Overrides:
gameIsOver in class GameLoop
Returns:
true if the game is over, false otherwise

isGameOver

public boolean isGameOver()

setGameOver

public void setGameOver(boolean gameOver)
Description copied from class: GameLoop
sets the game state to gameOver. What this does is sets the game over level (if there is one) to active and the current leve (if there is one) to inactive. From the game over level, it is possible to restart the game. Calling this method does not permanently halt the execution of the game.

Overrides:
setGameOver in class GameLoop
Parameters:
gameOver - true indicating the game over status should be set to game over, false does nothing

getPlayer

public Player getPlayer()
Description copied from class: GameLoop
gets the current player object. This method is equivalent to calling the getPlayer method with getID as the player number.

Overrides:
getPlayer in class GameLoop
Returns:
the Player object which contains that user's keyboard, mouse, and any messages sent

setCanvas

public void setCanvas(AnimationCanvas canvas)
Description copied from class: FrameAdvancer
set canvas to a new canvas

Overrides:
setCanvas in class FrameAdvancer

getCanvas

public AnimationCanvas getCanvas()
Description copied from class: FrameAdvancer
returns the canvas

Overrides:
getCanvas in class FrameAdvancer
Returns:
canvas

getTime

public double getTime()
Description copied from class: FrameAdvancer
returns the current time in seconds since the beginning of this game. When the game starts over, so does the time.

Overrides:
getTime in class FrameAdvancer
Returns:
the current time in seconds

getScreenRefreshRate

public double getScreenRefreshRate()
Description copied from class: FrameAdvancer
returns the screen refresh rate

Overrides:
getScreenRefreshRate in class FrameAdvancer
Returns:
ScreenRefreshRate

setMinimumModelFrameRate

public void setMinimumModelFrameRate(int framesPerSecond)
Description copied from class: FrameAdvancer
sets the minimum number of frames which must be computed per second. This is separate from the screen frame rate in that more frames can be computed than displayed, but it can be affected by (and affect) the screen rate. Too high of a model frame rate can cause computation to slow down the display rate, and too low of a model frame rate can cause important events to be missed (typically the intersection of Sprites). Too high a model frame rate can slow down the advancing of time to slower than physical time. Frame rates higher than 200 Hz are not allowed.

Overrides:
setMinimumModelFrameRate in class FrameAdvancer
Parameters:
framesPerSecond - the number of frames computed per second

scheduleRelative

public final void scheduleRelative(Alarm alarm,
                                   double relative)
Description copied from class: FrameAdvancer
sets and alarm to go off relative to the current time. For example, this method can be used to set off an alarm in 5 seconds from the current time.

Specified by:
scheduleRelative in interface AlarmScheduler
Overrides:
scheduleRelative in class FrameAdvancer
Parameters:
alarm - the class to call the alarm method on
relative - the time from now in seconds to call the alarm method

scheduleAbsolute

public final void scheduleAbsolute(Alarm alarm,
                                   double absolute)
Description copied from class: FrameAdvancer
sets and alarm to go off at a time relative to the beginning of time (zero). For example, this method can be used to set off an alarm 30 seconds from the beginning time.

Specified by:
scheduleAbsolute in interface AlarmScheduler
Overrides:
scheduleAbsolute in class FrameAdvancer
Parameters:
alarm - the class to call the alarm method on
absolute - the time in seconds to call the alarm method

cancelAlarm

public final void cancelAlarm(Alarm alarm)
Description copied from class: FrameAdvancer
removes all pending alarms on this object. If there are no alarms with this object as the target, the method call is ignored.

Specified by:
cancelAlarm in interface AlarmScheduler
Overrides:
cancelAlarm in class FrameAdvancer
Parameters:
alarm - the object that is the target of a pending alarm

cancelAllAlarms

public final void cancelAllAlarms()
Description copied from class: FrameAdvancer
removes all pending alarms. If there are no pending alarms, the method call is ignored.

Specified by:
cancelAllAlarms in interface AlarmScheduler
Overrides:
cancelAllAlarms in class FrameAdvancer

getAlarms

public final Alarm[] getAlarms()
Description copied from class: FrameAdvancer
gets the list of alarms scheduled to go off in the future.

Overrides:
getAlarms in class FrameAdvancer
Returns:
the array of alarms in the order which they would go off

schedule

public void schedule(TimedAction action,
                     double delay)
Overrides:
schedule in class FrameAdvancer

cancel

public void cancel(TimedAction action)
Overrides:
cancel in class FrameAdvancer

cancelAllTimedActions

public void cancelAllTimedActions()
Overrides:
cancelAllTimedActions in class FrameAdvancer

getAllTimedActions

public TimedAction[] getAllTimedActions()
Overrides:
getAllTimedActions in class FrameAdvancer

updateModel

public void updateModel(double time)
Description copied from class: FrameAdvancer
updates the model between displays. This method can split the time passed if more time has passed since the last display than the maximum time interval allowable for the model frame rate.

Overrides:
updateModel in class FrameAdvancer
Parameters:
time - the current absolute time

setCursor

public void setCursor(URL url)
Description copied from class: FrameAdvancer
sets the cursor for the game engine

Overrides:
setCursor in class FrameAdvancer

removeCursor

public void removeCursor()
Description copied from class: FrameAdvancer
removes the cursor from the game canvas

Overrides:
removeCursor in class FrameAdvancer

restoreCursor

public void restoreCursor()
Description copied from class: FrameAdvancer
adds the default cursor back to the screen

Overrides:
restoreCursor in class FrameAdvancer

refreshScreen

public final void refreshScreen()
Description copied from class: FrameAdvancer
updates the AnimationCanvas, should only be called from the AWTEvent Thread.

Overrides:
refreshScreen in class FrameAdvancer

resetTime

public void resetTime()
Description copied from class: FrameAdvancer
makes the current time zero

Overrides:
resetTime in class FrameAdvancer

runAsApplication

public void runAsApplication()
Description copied from class: GameWindow
runs as an application. This opens up the game in a new window.

Overrides:
runAsApplication in class GameWindow

setTitle

public void setTitle(String topTitle)
Description copied from class: GameWindow
Sets the title at the top of the JFrame and/or applet

Overrides:
setTitle in class GameWindow
Parameters:
topTitle - the text for the title

setHelp

public void setHelp(String filename)
Description copied from class: GameWindow
this method must be called in order to set the help screen. The filename is relative to the class which makes the call. Only what is between the body tags will be displayed, and the full html specs are not supported. Therefore use only simple html in order to make the help display properly.

Overrides:
setHelp in class GameWindow
Parameters:
filename - the relative file name of the help html file

setHelpText

public void setHelpText(String helpText)
Overrides:
setHelpText in class GameWindow