javoids
Class Javoids

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 javoids.Javoids
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.event.ComponentListener, java.awt.event.ItemListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.lang.Runnable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.HyperlinkListener, javax.swing.event.MenuKeyListener, javax.swing.event.MouseInputListener, javax.swing.RootPaneContainer

public class Javoids
extends javax.swing.JApplet
implements java.lang.Runnable, java.awt.event.ActionListener, javax.swing.event.MouseInputListener, java.awt.event.KeyListener, javax.swing.event.MenuKeyListener, java.awt.event.ItemListener, java.awt.event.ComponentListener, java.awt.event.WindowListener, javax.swing.event.HyperlinkListener

The Javoids Game. This class handles the overall functioning of the game. An asteroids like game.

Version:
1.045
Author:
Patrick Mallette
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JApplet
javax.swing.JApplet.AccessibleJApplet
 
Nested classes/interfaces inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
private  javax.swing.AbstractAction actionAbout
          an action to view the about information
private  javax.swing.AbstractAction actionAreaChecking
          an action to toggle between area checking and circular bounds collision detection
private  javax.swing.AbstractAction actionDelay
          an action to ajdust the delay
private  javax.swing.AbstractAction actionDifficulty
          an action to adjust the difficulty
private  javax.swing.AbstractAction actionExit
          an action to exit the game
private  javax.swing.AbstractAction actionKeyBinding
          an action to adjust the key code to action bindings
private  javax.swing.AbstractAction actionLicense
          an action to view the license file
private  javax.swing.AbstractAction actionLives
          an action to change the beginning number of lives
private  javax.swing.AbstractAction actionMouseMove
          an action to toggle between using the keyboard only or keyboard and mouse to move
private  javax.swing.AbstractAction actionNew
          an action to create a new game
private  javax.swing.AbstractAction actionReadMe
          an action to view the readme file
private  javax.swing.AbstractAction actionScores
          an action to start a new game
private  javax.swing.AbstractAction actionSound
          an action to toggle the sound on/off
private  javax.swing.AbstractAction actionUserKeyMap
          an action to toggle between the default and user key maps
private  javax.swing.AbstractAction actionVersion
          an action to view the version file
private  javax.swing.AbstractAction actionVolume
          an action to adjust the volume
private static Javoids applet
          the applet (this)
private  int bonus
          the bonus amount of points to award at the end of a level
private static int BONUS
          bonus to award when a level is complete (starting value)
private static int BONUS_INCREMENT
          bonus to award when a level is complete (increment value added to starting value * the level)
private  javax.swing.Timer bonusTimer
          a timer for determining when to decrement the bonus
private  SpriteVector<Bullet> bullets
          a list of all bullets
private  java.awt.Cursor cursorCrosshair
          the crosshair cursor (for mouse move)
private  java.awt.Cursor cursorDefault
          the default cursor
private static int DEFAULT_DELAY
          the default delay
private static int DEFAULT_DELAY_MINE
          default delay before a mine appears
private static int DEFAULT_DELAY_POWERUP
          default delay before a powerup appears
private static int DEFAULT_DELAY_SHIP
          default delay before a ship appears
private static int DEFAULT_DELAY_SINGULARITY
          default delay before a singularity appears
private static int DEFAULT_DIFFICULTY
          the default difficulty
private static int delay
          the delay to use before redrawing the screen (in ms)
private static int DELAY_BONUS
          delay for reducing the bonus
private static int DELAY_HIGHSCORE
          delay before showing high score table when the game is over
private static int DELAY_PLAYTIMER
          ddelay before beginning play
private static java.lang.String[] delayValues
          a list of the delays to use
private static int difficulty
          the difficulty level
private static java.lang.String[] difficultyValues
          a list of the difficulty levels to use
private  java.lang.String duration
          the formatted play duration
private  javax.swing.Timer eatableGhostTimer
          a timer for determining when to switch ghosts back so they can't be eaten
private  javax.swing.JEditorPane editorPane
          an editor pane to display files
private  SpriteVector<Explosion> explosions
          a list of all explosions
private  javax.swing.JMenuItem fileExit
          the file | exit menu item
private  javax.swing.JMenu fileMenu
          the file menu
private  javax.swing.JMenuItem fileNew
          the file | new menu item
private  javax.swing.JMenuItem fileScores
          the file | high score menu item
private  java.awt.Font fontCourierNew
          courier new font
private static javax.swing.JFrame frame
          the frame holding the game
private  java.awt.Canvas gameCanvas
          the game canvas where drawing is performed
private  java.awt.Graphics2D graphicsBuffer
          the graphics context for drawing
private  SpriteVector<GravityPoint> gravityPlane
          a list of all gravitry points
private static int height
          the game display height (not counting menu or status bar areas)
private  javax.swing.JMenuItem helpAbout
          the help | about menu item
private  javax.swing.JMenuItem helpLicense
          the help | license menu item
private  javax.swing.JMenu helpMenu
          the help menu
private  javax.swing.JPanel helpPanel
          a panel to display help information
private  javax.swing.JMenuItem helpReadMe
          the help | readme menu item
private  javax.swing.JMenuItem helpVersion
          the help | version menu item
private  HighScorePanel highScorePanel
          the high score panel
private  javax.swing.Timer highScoreTimer
          a timer for determining when to display the high score table after the game is over
private  java.awt.image.VolatileImage imageBuffer
          an image to use in double buffering
private  javax.swing.ImageIcon infiniteIcon
          an icon for the infinity symbol
private  javax.swing.JLabel infoLabel
          a lable to display game information
private  javax.swing.JPanel infoPanel
          a panel to display game information
private static int INITIAL_DELAY_EATABLE_GHOST
          initial delay before ghosts are no longer eatable appears
private static int INITIAL_DELAY_JAVOID
          initial delay before a javoid appears
private static int INITIAL_DELAY_MINE
          initial delay before a mine appears
private static int INITIAL_DELAY_POWERUP
          initial delay before a powerup appears
private static int INITIAL_DELAY_SHIP
          initial delay before a ship appears
private static int INITIAL_DELAY_SINGULARITY
          initial delay before a singularity appears
private static boolean isApplet
          is the game an applet?
private  boolean isAreaChecking
          is area checking being used?
private  boolean isEatableGhost
          are the ghosts edible?
private  boolean isFirstGame
          is this the first game?
private  boolean isGameOver
          is the game over?
private  boolean isGameStarted
          is the game started?
private  boolean isMouseMove
          is the mouse allowed to move the player
private  boolean isPacmanGame
          is it a pacman game?
private  boolean isRunning
          is the game running?
private  boolean isScreenInitialized
          is the screen initialized?
private  boolean isSound
          is the sound on?
private  boolean isUserKeyMap
          is the user using his own keymap?
private static double JAVOID_CREATION_CHANCE
          the chance for a singularity (white hole) to create a javoid
private  SpriteVector<Javoid> javoids
          a list of all javoids
private static java.lang.String[][] JAVOIDSPARMS
          the parameters for the game
private  javax.swing.Timer javoidTimer
          a timer for javoid scheduling
private  KeyDialog keyDialog
          a dialog to modify the key code to action settings
private static KeyMap keyMap
          the mapping of key codes to actions
private  int level
          the game level
private  int lives
          the number of lives a player should have
private static java.lang.String[] livesValues
          a list of the number of lives to use
private static int MAX_DELAY
          the maximum delay
private static int MAX_DIFFICULTY
          the maximum difficulty
private static int MAX_LIVES
          the maximum lives
private  javax.swing.JMenuBar menuBar
          the menu bar
private  javax.swing.JPopupMenu menuPopup
          a popup menu
private static int MIN_DELAY
          the minimum delay
private static int MIN_DIFFICULTY
          the minimum difficulty level
private static int MIN_HEIGHT
          the minimum screen height
private static int MIN_LIVES
          the minimum lives
private static int MIN_WIDTH
          the minimum screen width
private  SpriteVector<Mine> mines
          a list of all mines
private  javax.swing.Timer mineTimer
          a timer for mine scheduling
private  Move mouseMove
          the mouse's location
private  int oldHeight
          the old game height
private  int oldWidth
          the old game width
private  javax.swing.JCheckBoxMenuItem optionAreaChecking
          the option | area checking menu item
private  javax.swing.JMenuItem optionDelay
          the option | delay menu item
private  javax.swing.JMenuItem optionDifficulty
          the option | difficulty menu item
private  javax.swing.JMenuItem optionKeyBinding
          the option | key bindings menu item
private  javax.swing.JMenuItem optionLives
          the option | lives menu item
private  javax.swing.JMenu optionMenu
          the option menu
private  javax.swing.JCheckBoxMenuItem optionMouseMove
          the option | mouse move menu item
private  javax.swing.JCheckBoxMenuItem optionSound
          the option | sound menu item
private  javax.swing.JCheckBoxMenuItem optionUserKeyMap
          the option | user key map menu item
private  javax.swing.JMenuItem optionVolume
          the option | volume menu item
private  javax.swing.JPanel panelAmmo
          a panel to display each weapon's ammunition
private  java.util.HashMap<Item.Type,ToolPanel> panelWeapon
          a panel to display the weapon information
private  int playTime
          the play duration
private  javax.swing.Timer playTimer
          a timer for determining how long play was
private  SpriteVector<PowerUp> powerUps
          a list of all powerups
private  javax.swing.Timer powerUpTimer
          a timer for powerup scheduling
private  javax.swing.JProgressBar progressBarBonus
          a bar to display the amount of a bonus remaining
private  javax.swing.JProgressBar progressBarHealth
          a bar to display the health level
private  javax.swing.JProgressBar progressBarShield
          a bar to display the shield's health level
private  java.awt.Rectangle screen
          the screen bounds
private  javax.swing.JScrollPane scrollPane
          a scroll pane to allow scrolling
private static int SECOND
          one second
private  javax.swing.border.LineBorder selectedBorder
          a line border for decoration of frames
private static long serialVersionUID
          This is the version used for serializing/deserializing (storing/retrieving) this object
private  Ship shipPlayer
          the player's ship
private  SpriteVector<Ship> ships
          a list of all ships
private  javax.swing.Timer shipTimer
          a timer for ship scheduling
private  SpriteVector<Singularity> singularitys
          a list of all singularities
private  javax.swing.Timer singularityTimer
          a timer for singularity scheduling
private  javax.swing.JButton startButton
          the start button
private  java.lang.Thread thread
          a thread for handling game play
private static java.lang.String userHome
          the user's home directory
private static java.lang.String[] volumeValues
          a list of the volume levels to use
private static int width
          the game display width (not counting menu or status bar areas)
 
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
Javoids()
          Constructor (default)
Javoids(boolean _isApplet)
          Constructor (default)
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent actionEvent)
          Handle all of the actions in the game.
 void actionPerformedAbout()
          Display information about the game.
 void actionPerformedAreaChecking()
          Toggle between checking for collisions using a bounding circle and using the actual area the sprites take up.
 void actionPerformedDelay()
          Prompt the user to set the time delay of the game.
 void actionPerformedDifficulty()
          Prompt the user to set the difficulty of the game.
 void actionPerformedExit()
          Exit the game.
 void actionPerformedKeyBinding()
          Prompt the user to configure his keyboard set-up.
 void actionPerformedKeyMap()
          Toggle from the user's keymap to the default keymap.
 void actionPerformedLicense()
          Display the license file.
 void actionPerformedLives()
          Prompt the user to set the number of lives a player starts with.
 void actionPerformedMouseMove()
          Allow the player to play by using the mouse.
 void actionPerformedNew()
          Start a new game.
 void actionPerformedReadMe()
          Display the readme file.
 void actionPerformedScores()
          Display the high score table.
 void actionPerformedSound()
          Toggle the use of sound in the game between on/off.
 void actionPerformedVersion()
          Display the version file.
 void actionPerformedVolume()
          Prompt the user to set the volume level.
private  void addPanelItem(Item item)
           
private  void automaticActionSprites()
          Handle the actionjs of autonomous sprites (automatic move sprites).
private  boolean checkSecurityHighScores()
           
private  boolean checkSecurityKeyboard()
           
private  boolean checkSecurityUserHome()
           
 void componentHidden(java.awt.event.ComponentEvent componentEvent)
           
 void componentMoved(java.awt.event.ComponentEvent componentEvent)
           
 void componentResized(java.awt.event.ComponentEvent componentEvent)
          The component was resized, adjust the game canvas etc.
 void componentShown(java.awt.event.ComponentEvent componentEvent)
           
private
<E extends BasicSprite>
SpriteVector<Explosion>
createExplosions(SpriteVector<E> sprites)
           
 void createGravityPlane()
          Create a collection of sprites that act as a plane or other shape (that attract the Javoids and ships to it).
 SpriteVector<Javoid> createLevelJavoids()
          Create all of the javoids for the new level.
 void detectCollisions()
          Detect collisions between sprites.
 void drawSprites(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
          Draw all of the sprites.
 void FileNewGame()
          Perform the basic work of starting a new game.
private  java.lang.String formatTime(int time)
           
 java.lang.String getAppletInfo()
           
static int getDifficulty()
           
 java.awt.Dimension getFrameMinimumSize()
           
 java.awt.Dimension getFramePreferredSize()
           
private  int getGameHeight()
           
private  int getGameWidth()
           
 java.awt.Dimension getMinimumSize()
           
 java.lang.String[][] getParameterInfo()
           
 java.awt.Dimension getPreferredSize()
           
 void handleAction()
          Handle actions from key or mouse presses.
private  void handleGamePlay()
          Process any key presses in the key map's list of pressed keys.
 void hyperlinkUpdate(javax.swing.event.HyperlinkEvent hyperlinkEvent)
          Follow a clicked link in one of the help screens.
 void init()
          Initialize the applet/application.
private  boolean initializeHighScores()
           
 void itemStateChanged(java.awt.event.ItemEvent itemEvent)
           
 void keyPressed(java.awt.event.KeyEvent keyEvent)
          A key was pressed, perform the associated action (if any).
 void keyReleased(java.awt.event.KeyEvent keyEvent)
          A key was released.
 void keyTyped(java.awt.event.KeyEvent keyEvent)
           
static void main(java.lang.String[] args)
          The main program when started as an application (never called when run as an applet)
private  void menuItemPause()
          Pause the game when a menu item is clicked.
private  void menuItemUnPause()
          Unpause the game after processing a menu item request.
 void menuKeyPressed(javax.swing.event.MenuKeyEvent menuKeyEvent)
          If the escpae key was pressed unpause the game and request focus to the game canvas to accept key events again.
 void menuKeyReleased(javax.swing.event.MenuKeyEvent menuKeyEvent)
           
 void menuKeyTyped(javax.swing.event.MenuKeyEvent menuKeyEvent)
           
private  void modifyShotCount()
          Modify a weapon's shot count.
private  void mouseAction(java.awt.event.MouseEvent mouseEvent)
          Process mouse commands (fire, afterburners and thrust).
 void mouseClicked(java.awt.event.MouseEvent mouseEvent)
          Unpause the game (if the popup menu is not displayed) and give focus to the game canvas to accept key events.
 void mouseDragged(java.awt.event.MouseEvent mouseEvent)
          Move the ship toward the mouse's current position.
 void mouseEntered(java.awt.event.MouseEvent mouseEvent)
           
 void mouseExited(java.awt.event.MouseEvent mouseEvent)
           
 void mouseMoved(java.awt.event.MouseEvent mouseEvent)
          Move the ship in response to mouse movement.
 void mousePressed(java.awt.event.MouseEvent mouseEvent)
          Handle moving the mouse and deal with things in the tool panel being pressed.
 void mouseReleased(java.awt.event.MouseEvent mouseEvent)
          Unpause the game (if the popup menu is not displayed) and give focus to the game canvas to accept key events.
 void moveSprites()
          Move the sprites and age them as necessary.
 void newGame()
          Reset game specific information (to start a new game).
 void paint(java.awt.Graphics graphics)
          Do all of the game drawing here (or pass it off to helper functions).
private  void pause()
          Toggle the game between being paused/unpaused.
 void removeDead()
          Remove sprites that are dead or expired their duration.
private  void restoreShips()
          Rstore all ships to their default values (alive if possible for a player, and dead otherwise).
 void run()
          Run the applet/application (handle game play, displays etc).
private  java.lang.String selectValue(java.lang.String message, java.lang.String title, java.lang.Object[] values, java.lang.Object selectedValue, int targetValue)
          Display a dialog to allow the suer to select a value from a list of values.
private  void setAmmoInformation(Item.Type currentItem, java.util.HashMap<Item.Type,? extends Item> items)
          Display the ammo information for each item.
private  void setDelays()
          Set the delays for timers based on the game difficulty.
private  void setDifficulty(int _difficulty)
          Set the game difficulty.
private  void setInformation(Ship ship, int _level)
          Set the game information up for display.
 void start()
          Start the applet/application.
 void startTimers()
          Start or re-start the timers.
 void stop()
          Stop the applet/application.
 void stopGame()
          Stop the timers, clean up all lists and say the game isn't running.
 void stopTimers()
          Stop the timers.
private  void switchPacmanGame(boolean reset)
          toggle to/from a pacman game
 java.lang.String toString()
          Provide a String representation of this object.
 void update(java.awt.Graphics graphics)
          Dummy method that calls paint(graphics) for compatibility with early Swing components.
 void windowActivated(java.awt.event.WindowEvent windowEvent)
          Set the focus to the game canvas so it can accept key events.
 void windowClosed(java.awt.event.WindowEvent windowEvent)
           
 void windowClosing(java.awt.event.WindowEvent windowEvent)
           
 void windowDeactivated(java.awt.event.WindowEvent windowEvent)
           
 void windowDeiconified(java.awt.event.WindowEvent windowEvent)
          Start game play and restart threads to handle game play.
 void windowIconified(java.awt.event.WindowEvent windowEvent)
          Stop game play and running threads to minimize CPU use.
 void windowOpened(java.awt.event.WindowEvent windowEvent)
           
 
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
 
Methods inherited from class java.applet.Applet
destroy, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
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, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, 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, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
This is the version used for serializing/deserializing (storing/retrieving) this object

See Also:
Constant Field Values

JAVOIDSPARMS

private static final transient java.lang.String[][] JAVOIDSPARMS
the parameters for the game


MIN_WIDTH

private static final int MIN_WIDTH
the minimum screen width

See Also:
Constant Field Values

MIN_HEIGHT

private static final int MIN_HEIGHT
the minimum screen height

See Also:
Constant Field Values

MIN_DIFFICULTY

private static final int MIN_DIFFICULTY
the minimum difficulty level

See Also:
Constant Field Values

MIN_DELAY

private static final int MIN_DELAY
the minimum delay

See Also:
Constant Field Values

MIN_LIVES

private static final int MIN_LIVES
the minimum lives

See Also:
Constant Field Values

MAX_DIFFICULTY

private static final int MAX_DIFFICULTY
the maximum difficulty

See Also:
Constant Field Values

MAX_DELAY

private static final int MAX_DELAY
the maximum delay

See Also:
Constant Field Values

MAX_LIVES

private static final int MAX_LIVES
the maximum lives

See Also:
Constant Field Values

DEFAULT_DIFFICULTY

private static final int DEFAULT_DIFFICULTY
the default difficulty

See Also:
Constant Field Values

DEFAULT_DELAY

private static final int DEFAULT_DELAY
the default delay

See Also:
Constant Field Values

JAVOID_CREATION_CHANCE

private static final double JAVOID_CREATION_CHANCE
the chance for a singularity (white hole) to create a javoid

See Also:
Constant Field Values

SECOND

private static final int SECOND
one second

See Also:
Constant Field Values

livesValues

private static final transient java.lang.String[] livesValues
a list of the number of lives to use


delayValues

private static final transient java.lang.String[] delayValues
a list of the delays to use


volumeValues

private static final transient java.lang.String[] volumeValues
a list of the volume levels to use


difficultyValues

private static final transient java.lang.String[] difficultyValues
a list of the difficulty levels to use


DELAY_PLAYTIMER

private static final int DELAY_PLAYTIMER
ddelay before beginning play

See Also:
Constant Field Values

DELAY_BONUS

private static final int DELAY_BONUS
delay for reducing the bonus

See Also:
Constant Field Values

DELAY_HIGHSCORE

private static final int DELAY_HIGHSCORE
delay before showing high score table when the game is over

See Also:
Constant Field Values

BONUS

private static final int BONUS
bonus to award when a level is complete (starting value)

See Also:
Constant Field Values

BONUS_INCREMENT

private static final int BONUS_INCREMENT
bonus to award when a level is complete (increment value added to starting value * the level)

See Also:
Constant Field Values

INITIAL_DELAY_POWERUP

private static int INITIAL_DELAY_POWERUP
initial delay before a powerup appears


INITIAL_DELAY_SHIP

private static int INITIAL_DELAY_SHIP
initial delay before a ship appears


INITIAL_DELAY_MINE

private static int INITIAL_DELAY_MINE
initial delay before a mine appears


INITIAL_DELAY_SINGULARITY

private static int INITIAL_DELAY_SINGULARITY
initial delay before a singularity appears


INITIAL_DELAY_JAVOID

private static int INITIAL_DELAY_JAVOID
initial delay before a javoid appears


INITIAL_DELAY_EATABLE_GHOST

private static int INITIAL_DELAY_EATABLE_GHOST
initial delay before ghosts are no longer eatable appears


DEFAULT_DELAY_POWERUP

private static int DEFAULT_DELAY_POWERUP
default delay before a powerup appears


DEFAULT_DELAY_SHIP

private static int DEFAULT_DELAY_SHIP
default delay before a ship appears


DEFAULT_DELAY_MINE

private static int DEFAULT_DELAY_MINE
default delay before a mine appears


DEFAULT_DELAY_SINGULARITY

private static int DEFAULT_DELAY_SINGULARITY
default delay before a singularity appears


delay

private static int delay
the delay to use before redrawing the screen (in ms)


keyMap

private static KeyMap keyMap
the mapping of key codes to actions


width

private static int width
the game display width (not counting menu or status bar areas)


height

private static int height
the game display height (not counting menu or status bar areas)


isApplet

private static boolean isApplet
is the game an applet?


frame

private static javax.swing.JFrame frame
the frame holding the game


applet

private static Javoids applet
the applet (this)


userHome

private static java.lang.String userHome
the user's home directory


difficulty

private static int difficulty
the difficulty level


javoids

private SpriteVector<Javoid> javoids
a list of all javoids


mines

private SpriteVector<Mine> mines
a list of all mines


explosions

private SpriteVector<Explosion> explosions
a list of all explosions


powerUps

private SpriteVector<PowerUp> powerUps
a list of all powerups


singularitys

private SpriteVector<Singularity> singularitys
a list of all singularities


bullets

private SpriteVector<Bullet> bullets
a list of all bullets


ships

private SpriteVector<Ship> ships
a list of all ships


gravityPlane

private SpriteVector<GravityPoint> gravityPlane
a list of all gravitry points


powerUpTimer

private javax.swing.Timer powerUpTimer
a timer for powerup scheduling


mineTimer

private javax.swing.Timer mineTimer
a timer for mine scheduling


singularityTimer

private javax.swing.Timer singularityTimer
a timer for singularity scheduling


javoidTimer

private javax.swing.Timer javoidTimer
a timer for javoid scheduling


shipTimer

private javax.swing.Timer shipTimer
a timer for ship scheduling


eatableGhostTimer

private javax.swing.Timer eatableGhostTimer
a timer for determining when to switch ghosts back so they can't be eaten


bonusTimer

private javax.swing.Timer bonusTimer
a timer for determining when to decrement the bonus


highScoreTimer

private javax.swing.Timer highScoreTimer
a timer for determining when to display the high score table after the game is over


playTimer

private javax.swing.Timer playTimer
a timer for determining how long play was


oldWidth

private int oldWidth
the old game width


oldHeight

private int oldHeight
the old game height


fontCourierNew

private java.awt.Font fontCourierNew
courier new font


editorPane

private javax.swing.JEditorPane editorPane
an editor pane to display files


scrollPane

private javax.swing.JScrollPane scrollPane
a scroll pane to allow scrolling


helpPanel

private javax.swing.JPanel helpPanel
a panel to display help information


keyDialog

private KeyDialog keyDialog
a dialog to modify the key code to action settings


menuPopup

private javax.swing.JPopupMenu menuPopup
a popup menu


menuBar

private javax.swing.JMenuBar menuBar
the menu bar


fileMenu

private javax.swing.JMenu fileMenu
the file menu


fileNew

private javax.swing.JMenuItem fileNew
the file | new menu item


fileScores

private javax.swing.JMenuItem fileScores
the file | high score menu item


fileExit

private javax.swing.JMenuItem fileExit
the file | exit menu item


optionMenu

private javax.swing.JMenu optionMenu
the option menu


optionDifficulty

private javax.swing.JMenuItem optionDifficulty
the option | difficulty menu item


optionDelay

private javax.swing.JMenuItem optionDelay
the option | delay menu item


optionLives

private javax.swing.JMenuItem optionLives
the option | lives menu item


optionKeyBinding

private javax.swing.JMenuItem optionKeyBinding
the option | key bindings menu item


optionUserKeyMap

private javax.swing.JCheckBoxMenuItem optionUserKeyMap
the option | user key map menu item


optionMouseMove

private javax.swing.JCheckBoxMenuItem optionMouseMove
the option | mouse move menu item


optionSound

private javax.swing.JCheckBoxMenuItem optionSound
the option | sound menu item


optionVolume

private javax.swing.JMenuItem optionVolume
the option | volume menu item


optionAreaChecking

private javax.swing.JCheckBoxMenuItem optionAreaChecking
the option | area checking menu item


helpMenu

private javax.swing.JMenu helpMenu
the help menu


helpReadMe

private javax.swing.JMenuItem helpReadMe
the help | readme menu item


helpVersion

private javax.swing.JMenuItem helpVersion
the help | version menu item


helpLicense

private javax.swing.JMenuItem helpLicense
the help | license menu item


helpAbout

private javax.swing.JMenuItem helpAbout
the help | about menu item


actionNew

private javax.swing.AbstractAction actionNew
an action to create a new game


actionScores

private javax.swing.AbstractAction actionScores
an action to start a new game


actionExit

private javax.swing.AbstractAction actionExit
an action to exit the game


actionDifficulty

private javax.swing.AbstractAction actionDifficulty
an action to adjust the difficulty


actionDelay

private javax.swing.AbstractAction actionDelay
an action to ajdust the delay


actionLives

private javax.swing.AbstractAction actionLives
an action to change the beginning number of lives


actionUserKeyMap

private javax.swing.AbstractAction actionUserKeyMap
an action to toggle between the default and user key maps


actionMouseMove

private javax.swing.AbstractAction actionMouseMove
an action to toggle between using the keyboard only or keyboard and mouse to move


actionSound

private javax.swing.AbstractAction actionSound
an action to toggle the sound on/off


actionVolume

private javax.swing.AbstractAction actionVolume
an action to adjust the volume


actionAreaChecking

private javax.swing.AbstractAction actionAreaChecking
an action to toggle between area checking and circular bounds collision detection


actionKeyBinding

private javax.swing.AbstractAction actionKeyBinding
an action to adjust the key code to action bindings


actionReadMe

private javax.swing.AbstractAction actionReadMe
an action to view the readme file


actionVersion

private javax.swing.AbstractAction actionVersion
an action to view the version file


actionLicense

private javax.swing.AbstractAction actionLicense
an action to view the license file


actionAbout

private javax.swing.AbstractAction actionAbout
an action to view the about information


startButton

private javax.swing.JButton startButton
the start button


infoLabel

private javax.swing.JLabel infoLabel
a lable to display game information


panelAmmo

private javax.swing.JPanel panelAmmo
a panel to display each weapon's ammunition


infoPanel

private javax.swing.JPanel infoPanel
a panel to display game information


highScorePanel

private HighScorePanel highScorePanel
the high score panel


infiniteIcon

private javax.swing.ImageIcon infiniteIcon
an icon for the infinity symbol


selectedBorder

private javax.swing.border.LineBorder selectedBorder
a line border for decoration of frames


gameCanvas

private java.awt.Canvas gameCanvas
the game canvas where drawing is performed


cursorDefault

private java.awt.Cursor cursorDefault
the default cursor


cursorCrosshair

private java.awt.Cursor cursorCrosshair
the crosshair cursor (for mouse move)


graphicsBuffer

private transient java.awt.Graphics2D graphicsBuffer
the graphics context for drawing


imageBuffer

private transient java.awt.image.VolatileImage imageBuffer
an image to use in double buffering


screen

private java.awt.Rectangle screen
the screen bounds


panelWeapon

private java.util.HashMap<Item.Type,ToolPanel> panelWeapon
a panel to display the weapon information


progressBarHealth

private javax.swing.JProgressBar progressBarHealth
a bar to display the health level


progressBarShield

private javax.swing.JProgressBar progressBarShield
a bar to display the shield's health level


progressBarBonus

private javax.swing.JProgressBar progressBarBonus
a bar to display the amount of a bonus remaining


thread

private transient volatile java.lang.Thread thread
a thread for handling game play


isFirstGame

private boolean isFirstGame
is this the first game?


isGameStarted

private boolean isGameStarted
is the game started?


isRunning

private boolean isRunning
is the game running?


isGameOver

private boolean isGameOver
is the game over?


isPacmanGame

private boolean isPacmanGame
is it a pacman game?


isEatableGhost

private boolean isEatableGhost
are the ghosts edible?


isMouseMove

private boolean isMouseMove
is the mouse allowed to move the player


isUserKeyMap

private boolean isUserKeyMap
is the user using his own keymap?


isSound

private boolean isSound
is the sound on?


isAreaChecking

private boolean isAreaChecking
is area checking being used?


isScreenInitialized

private boolean isScreenInitialized
is the screen initialized?


lives

private int lives
the number of lives a player should have


bonus

private int bonus
the bonus amount of points to award at the end of a level


shipPlayer

private Ship shipPlayer
the player's ship


mouseMove

private Move mouseMove
the mouse's location


level

private int level
the game level


playTime

private int playTime
the play duration


duration

private java.lang.String duration
the formatted play duration

Constructor Detail

Javoids

public Javoids()
Constructor (default)


Javoids

public Javoids(boolean _isApplet)
Constructor (default)

Parameters:
_isApplet - is this an applet?
Method Detail

main

public static void main(java.lang.String[] args)
The main program when started as an application (never called when run as an applet)

Parameters:
args - a list of arguments passed to the program

init

public void init()
Initialize the applet/application.

Overrides:
init in class java.applet.Applet

start

public void start()
Start the applet/application.

Overrides:
start in class java.applet.Applet

stop

public void stop()
Stop the applet/application.

Overrides:
stop in class java.applet.Applet

run

public void run()
Run the applet/application (handle game play, displays etc).

Specified by:
run in interface java.lang.Runnable

getGameWidth

private int getGameWidth()
Returns:
the game canvas' width

getGameHeight

private int getGameHeight()
Returns:
the game canvas' height

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class java.awt.Container
Returns:
the minimum size for the frame

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class java.awt.Container
Returns:
the preferred size for the frame

getFrameMinimumSize

public java.awt.Dimension getFrameMinimumSize()
Returns:
the minimum allowable size of the game's frame

getFramePreferredSize

public java.awt.Dimension getFramePreferredSize()
Returns:
the preferred size of the game's frame

componentMoved

public void componentMoved(java.awt.event.ComponentEvent componentEvent)
Specified by:
componentMoved in interface java.awt.event.ComponentListener
Parameters:
componentEvent - the component's event

componentShown

public void componentShown(java.awt.event.ComponentEvent componentEvent)
Specified by:
componentShown in interface java.awt.event.ComponentListener
Parameters:
componentEvent - the component's event

componentHidden

public void componentHidden(java.awt.event.ComponentEvent componentEvent)
Specified by:
componentHidden in interface java.awt.event.ComponentListener
Parameters:
componentEvent - the component's event

componentResized

public void componentResized(java.awt.event.ComponentEvent componentEvent)
The component was resized, adjust the game canvas etc.

Specified by:
componentResized in interface java.awt.event.ComponentListener
Parameters:
componentEvent - the component's event

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent itemEvent)
Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
itemEvent - the item event to handle

windowOpened

public void windowOpened(java.awt.event.WindowEvent windowEvent)
Specified by:
windowOpened in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowClosing

public void windowClosing(java.awt.event.WindowEvent windowEvent)
Specified by:
windowClosing in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowClosed

public void windowClosed(java.awt.event.WindowEvent windowEvent)
Specified by:
windowClosed in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowActivated

public void windowActivated(java.awt.event.WindowEvent windowEvent)
Set the focus to the game canvas so it can accept key events.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent windowEvent)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowIconified

public void windowIconified(java.awt.event.WindowEvent windowEvent)
Stop game play and running threads to minimize CPU use.

Specified by:
windowIconified in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent windowEvent)
Start game play and restart threads to handle game play.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Parameters:
windowEvent - the window event to handle

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
mouseEvent - the mouse event to handle

mouseExited

public void mouseExited(java.awt.event.MouseEvent mouseEvent)
Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
mouseEvent - the mouse event to handle

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent mouseEvent)
Unpause the game (if the popup menu is not displayed) and give focus to the game canvas to accept key events.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
mouseEvent - the mouse event to handle

mousePressed

public void mousePressed(java.awt.event.MouseEvent mouseEvent)
Handle moving the mouse and deal with things in the tool panel being pressed.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
mouseEvent - the mouse event to handle

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent mouseEvent)
Unpause the game (if the popup menu is not displayed) and give focus to the game canvas to accept key events. When the middle mouse button is pressed use the afterburner (if the game is being played). Select a tool if it is clicked and it is one of the guns or rockets.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
mouseEvent - the mouse event to handle

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent mouseEvent)
Move the ship toward the mouse's current position.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
mouseEvent - the mouse event to handle

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent mouseEvent)
Move the ship in response to mouse movement.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
mouseEvent - the mouse event to handle

keyPressed

public void keyPressed(java.awt.event.KeyEvent keyEvent)
A key was pressed, perform the associated action (if any). Add the key to the list of keys pressed.

Specified by:
keyPressed in interface java.awt.event.KeyListener
Parameters:
keyEvent - the key event to handle

keyReleased

public void keyReleased(java.awt.event.KeyEvent keyEvent)
A key was released. Remove the key from the list of keys pressed.

Specified by:
keyReleased in interface java.awt.event.KeyListener
Parameters:
keyEvent - the key event to handle

keyTyped

public void keyTyped(java.awt.event.KeyEvent keyEvent)
Specified by:
keyTyped in interface java.awt.event.KeyListener
Parameters:
keyEvent - the key event to handle

menuKeyPressed

public void menuKeyPressed(javax.swing.event.MenuKeyEvent menuKeyEvent)
If the escpae key was pressed unpause the game and request focus to the game canvas to accept key events again.

Specified by:
menuKeyPressed in interface javax.swing.event.MenuKeyListener
Parameters:
menuKeyEvent - the menu key event to handle

menuKeyReleased

public void menuKeyReleased(javax.swing.event.MenuKeyEvent menuKeyEvent)
Specified by:
menuKeyReleased in interface javax.swing.event.MenuKeyListener
Parameters:
menuKeyEvent - the menu key event to handle

menuKeyTyped

public void menuKeyTyped(javax.swing.event.MenuKeyEvent menuKeyEvent)
Specified by:
menuKeyTyped in interface javax.swing.event.MenuKeyListener
Parameters:
menuKeyEvent - the menu key event to handle

actionPerformedNew

public void actionPerformedNew()
Start a new game.


actionPerformedScores

public void actionPerformedScores()
Display the high score table.


actionPerformedExit

public void actionPerformedExit()
Exit the game.


selectValue

private java.lang.String selectValue(java.lang.String message,
                                     java.lang.String title,
                                     java.lang.Object[] values,
                                     java.lang.Object selectedValue,
                                     int targetValue)
Display a dialog to allow the suer to select a value from a list of values.

Parameters:
message - the message to display in the dialog
title - the title of the dialog
values - the values to use in the dropdown list
selectedValue - the default selected value
targetValue - the currently selected value
Returns:
the selected value

actionPerformedDifficulty

public void actionPerformedDifficulty()
Prompt the user to set the difficulty of the game.


actionPerformedDelay

public void actionPerformedDelay()
Prompt the user to set the time delay of the game.


actionPerformedLives

public void actionPerformedLives()
Prompt the user to set the number of lives a player starts with.


actionPerformedKeyBinding

public void actionPerformedKeyBinding()
Prompt the user to configure his keyboard set-up.


actionPerformedKeyMap

public void actionPerformedKeyMap()
Toggle from the user's keymap to the default keymap.


actionPerformedMouseMove

public void actionPerformedMouseMove()
Allow the player to play by using the mouse.


actionPerformedSound

public void actionPerformedSound()
Toggle the use of sound in the game between on/off.


actionPerformedVolume

public void actionPerformedVolume()
Prompt the user to set the volume level.


actionPerformedAreaChecking

public void actionPerformedAreaChecking()
Toggle between checking for collisions using a bounding circle and using the actual area the sprites take up.


actionPerformedReadMe

public void actionPerformedReadMe()
Display the readme file.


actionPerformedVersion

public void actionPerformedVersion()
Display the version file.


actionPerformedLicense

public void actionPerformedLicense()
Display the license file.


actionPerformedAbout

public void actionPerformedAbout()
Display information about the game.


actionPerformed

public void actionPerformed(java.awt.event.ActionEvent actionEvent)
Handle all of the actions in the game.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
actionEvent - the action event to handle

hyperlinkUpdate

public void hyperlinkUpdate(javax.swing.event.HyperlinkEvent hyperlinkEvent)
Follow a clicked link in one of the help screens.

Specified by:
hyperlinkUpdate in interface javax.swing.event.HyperlinkListener
Parameters:
hyperlinkEvent - the hyperlink event to handle

paint

public void paint(java.awt.Graphics graphics)
Do all of the game drawing here (or pass it off to helper functions).

Overrides:
paint in class java.awt.Container
Parameters:
graphics - the graphics context to use for drawing in the game.

update

public void update(java.awt.Graphics graphics)
Dummy method that calls paint(graphics) for compatibility with early Swing components.

Overrides:
update in class javax.swing.JApplet
Parameters:
graphics - the graphics context to use for drawing in the game.

getAppletInfo

public java.lang.String getAppletInfo()
Overrides:
getAppletInfo in class java.applet.Applet
Returns:
the information about the applet

getParameterInfo

public java.lang.String[][] getParameterInfo()
Overrides:
getParameterInfo in class java.applet.Applet
Returns:
the information about the applet's parameters.

FileNewGame

public void FileNewGame()
Perform the basic work of starting a new game.


newGame

public void newGame()
Reset game specific information (to start a new game).


checkSecurityUserHome

private boolean checkSecurityUserHome()
Returns:
true if the user's home was set and the game has access, otherwise return false

checkSecurityHighScores

private boolean checkSecurityHighScores()
Returns:
true if the high score can be read and the game has access, otherwise return false

checkSecurityKeyboard

private boolean checkSecurityKeyboard()
Returns:
true if the keyboard file can be read and the game has access, otherwise return false

initializeHighScores

private boolean initializeHighScores()
Returns:
true if the high score file was read successfully otherwise return false

startTimers

public void startTimers()
Start or re-start the timers.


stopGame

public void stopGame()
Stop the timers, clean up all lists and say the game isn't running.


stopTimers

public void stopTimers()
Stop the timers.


mouseAction

private void mouseAction(java.awt.event.MouseEvent mouseEvent)
Process mouse commands (fire, afterburners and thrust).

Parameters:
mouseEvent - the mouse event to handle

menuItemPause

private void menuItemPause()
Pause the game when a menu item is clicked.


menuItemUnPause

private void menuItemUnPause()
Unpause the game after processing a menu item request.


pause

private void pause()
Toggle the game between being paused/unpaused.


handleGamePlay

private void handleGamePlay()
Process any key presses in the key map's list of pressed keys.


handleAction

public void handleAction()
Handle actions from key or mouse presses.


detectCollisions

public void detectCollisions()
Detect collisions between sprites.


restoreShips

private void restoreShips()
Rstore all ships to their default values (alive if possible for a player, and dead otherwise).


moveSprites

public void moveSprites()
Move the sprites and age them as necessary.


automaticActionSprites

private void automaticActionSprites()
Handle the actionjs of autonomous sprites (automatic move sprites).


removeDead

public void removeDead()
Remove sprites that are dead or expired their duration.


modifyShotCount

private void modifyShotCount()
Modify a weapon's shot count.


drawSprites

public void drawSprites(java.awt.Graphics2D g2d,
                        java.awt.Graphics2D foregroundImage)
Draw all of the sprites.

Parameters:
g2d - the graphics context to use in drawing.
foregroundImage - the image to draw on (used for double buffering)

createExplosions

private <E extends BasicSprite> SpriteVector<Explosion> createExplosions(SpriteVector<E> sprites)
Type Parameters:
E - the type of sprite creating explosions
Parameters:
sprites - the sprites to create explosions for.
Returns:
a list of explosions

createGravityPlane

public void createGravityPlane()
Create a collection of sprites that act as a plane or other shape (that attract the Javoids and ships to it).


createLevelJavoids

public SpriteVector<Javoid> createLevelJavoids()
Create all of the javoids for the new level.

Returns:
a list of new javoids

setInformation

private void setInformation(Ship ship,
                            int _level)
Set the game information up for display.

Parameters:
ship - the player's ship
_level - the game level

formatTime

private java.lang.String formatTime(int time)
Parameters:
time - the time to format
Returns:
the formatted time value.

setAmmoInformation

private void setAmmoInformation(Item.Type currentItem,
                                java.util.HashMap<Item.Type,? extends Item> items)
Display the ammo information for each item.

Parameters:
currentItem - the currently selected item
items - the list of item mappings

setDelays

private void setDelays()
Set the delays for timers based on the game difficulty.


setDifficulty

private void setDifficulty(int _difficulty)
Set the game difficulty.

Parameters:
_difficulty - the desired difficulty

getDifficulty

public static int getDifficulty()
Returns:
the difficulty setting for the game

switchPacmanGame

private void switchPacmanGame(boolean reset)
toggle to/from a pacman game

Parameters:
reset - true (use a pacman game)/false (don't use a pacman game)

addPanelItem

private void addPanelItem(Item item)
Parameters:
item - the item to add to the tool panel

toString

public java.lang.String toString()
Provide a String representation of this object.

Overrides:
toString in class java.awt.Component
Returns:
String A representation of the object for debugging.