Class Game

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--java.applet.Applet
                          |
                          +--Game
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.event.ActionListener, BattleEndListener, BattleListener, java.util.EventListener, GameOverListener, java.awt.image.ImageObserver, java.awt.MenuContainer, RedirectListener, SaveListener, java.io.Serializable, ShopEndListener

public class Game
extends java.applet.Applet
implements java.awt.event.ActionListener, BattleListener, BattleEndListener, RedirectListener, ShopEndListener, GameOverListener, SaveListener

Main class to handle the switching between game modes, and initiation of the game.

See Also:
Grid, Battle, Shop, PlayerLoader, PlayerSaver, MapLoader, Serialized Form

Field Summary
 
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
Game()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          Handle Button clicks to load, start a new game, etc.
 void battleBegin(BattleEvent e)
          Handle a battleBegin Event, ie pause Grid, display the Battle system and move the MapObjects between the two.
 void battleEnd(BattleEndEvent e)
          Handle a battleEnd Event, ie unpause Grid, display the Grid system, destroy Battle system and move the MapObjects between the two.
 void gameOver(GameOverEvent e)
          Handle a GameOver Event, ie display the Game Over splash and offer the player the option to rebegin.
 void init()
          Starts the game displaying the default Splash Screen to the user.
 void initGrid()
          Get the Grid ready to be redisplayed after it was removed, ie add the Monsters.
 void loadPlayerFile(java.lang.String file)
          Handle the loading of a Player file.
 void paint(java.awt.Graphics g)
          Draw the Components
 void redirectFired(RedirectEvent e)
          Handle a redirect event, ie load the new map specified in the RedirectEvent.
 void saveGame(SaveEvent e)
          Handle a SaveGame Event, ie take the Player specified in SaveEvent and pass it to PlayerSaver then place this text in a TextArea for the user to save it.
 void setUpImages()
          Load all the required Images and instantiate the classes that depend on them.
 void shopEnd(ShopEndEvent e)
          Handle a shopEnd Event, ie display the Shop, and move Player between the two
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, 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, 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, isOpaque, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, 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
 

Constructor Detail

Game

public Game()
Method Detail

init

public void init()
Starts the game displaying the default Splash Screen to the user.

Overrides:
init in class java.applet.Applet

battleBegin

public void battleBegin(BattleEvent e)
Handle a battleBegin Event, ie pause Grid, display the Battle system and move the MapObjects between the two.

Specified by:
battleBegin in interface BattleListener
Parameters:
e - the BattleEvent
See Also:
MapObject, Grid, Battle, Player, People, Monster

battleEnd

public void battleEnd(BattleEndEvent e)
Handle a battleEnd Event, ie unpause Grid, display the Grid system, destroy Battle system and move the MapObjects between the two.

Specified by:
battleEnd in interface BattleEndListener
Parameters:
e - the BattleEndEvent
See Also:
MapObject, Grid, Battle, Player, People, Monster

shopEnd

public void shopEnd(ShopEndEvent e)
Handle a shopEnd Event, ie display the Shop, and move Player between the two

Specified by:
shopEnd in interface ShopEndListener
Parameters:
e - the ShopEndEvent
See Also:
MapObject, Grid, Battle, Player, People, Monster

redirectFired

public void redirectFired(RedirectEvent e)
Handle a redirect event, ie load the new map specified in the RedirectEvent. If the map specified is Shop load the Shop system.

Specified by:
redirectFired in interface RedirectListener
Parameters:
e - the RedirectEvent
See Also:
MapObject, Grid, RedirectEvent, MapLoader

gameOver

public void gameOver(GameOverEvent e)
Handle a GameOver Event, ie display the Game Over splash and offer the player the option to rebegin.

Specified by:
gameOver in interface GameOverListener
Parameters:
e - the GameOverEvent
See Also:
MapObject, Grid, Battle, Player, People, Monster

saveGame

public void saveGame(SaveEvent e)
Handle a SaveGame Event, ie take the Player specified in SaveEvent and pass it to PlayerSaver then place this text in a TextArea for the user to save it.

Specified by:
saveGame in interface SaveListener
Parameters:
e - the SaveEvent
See Also:
MapObject, PlayerSaver, SaveEvent, Player, People, Monster

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Handle Button clicks to load, start a new game, etc.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - the ActionEvent

paint

public void paint(java.awt.Graphics g)
Draw the Components

Overrides:
paint in class java.awt.Container

setUpImages

public void setUpImages()
Load all the required Images and instantiate the classes that depend on them.


initGrid

public void initGrid()
Get the Grid ready to be redisplayed after it was removed, ie add the Monsters.


loadPlayerFile

public void loadPlayerFile(java.lang.String file)
Handle the loading of a Player file.

See Also:
Player, PlayerLoader