|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
javax.swing.JApplet
javoids.Javoids
public class Javoids
The Javoids Game. This class handles the overall functioning of the game. An asteroids like game.
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
|
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 |
---|
private static final long serialVersionUID
private static final transient java.lang.String[][] JAVOIDSPARMS
private static final int MIN_WIDTH
private static final int MIN_HEIGHT
private static final int MIN_DIFFICULTY
private static final int MIN_DELAY
private static final int MIN_LIVES
private static final int MAX_DIFFICULTY
private static final int MAX_DELAY
private static final int MAX_LIVES
private static final int DEFAULT_DIFFICULTY
private static final int DEFAULT_DELAY
private static final double JAVOID_CREATION_CHANCE
private static final int SECOND
private static final transient java.lang.String[] livesValues
private static final transient java.lang.String[] delayValues
private static final transient java.lang.String[] volumeValues
private static final transient java.lang.String[] difficultyValues
private static final int DELAY_PLAYTIMER
private static final int DELAY_BONUS
private static final int DELAY_HIGHSCORE
private static final int BONUS
private static final int BONUS_INCREMENT
private static int INITIAL_DELAY_POWERUP
private static int INITIAL_DELAY_SHIP
private static int INITIAL_DELAY_MINE
private static int INITIAL_DELAY_SINGULARITY
private static int INITIAL_DELAY_JAVOID
private static int INITIAL_DELAY_EATABLE_GHOST
private static int DEFAULT_DELAY_POWERUP
private static int DEFAULT_DELAY_SHIP
private static int DEFAULT_DELAY_MINE
private static int DEFAULT_DELAY_SINGULARITY
private static int delay
private static KeyMap keyMap
private static int width
private static int height
private static boolean isApplet
private static javax.swing.JFrame frame
private static Javoids applet
private static java.lang.String userHome
private static int difficulty
private SpriteVector<Javoid> javoids
private SpriteVector<Mine> mines
private SpriteVector<Explosion> explosions
private SpriteVector<PowerUp> powerUps
private SpriteVector<Singularity> singularitys
private SpriteVector<Bullet> bullets
private SpriteVector<Ship> ships
private SpriteVector<GravityPoint> gravityPlane
private javax.swing.Timer powerUpTimer
private javax.swing.Timer mineTimer
private javax.swing.Timer singularityTimer
private javax.swing.Timer javoidTimer
private javax.swing.Timer shipTimer
private javax.swing.Timer eatableGhostTimer
private javax.swing.Timer bonusTimer
private javax.swing.Timer highScoreTimer
private javax.swing.Timer playTimer
private int oldWidth
private int oldHeight
private java.awt.Font fontCourierNew
private javax.swing.JEditorPane editorPane
private javax.swing.JScrollPane scrollPane
private javax.swing.JPanel helpPanel
private KeyDialog keyDialog
private javax.swing.JPopupMenu menuPopup
private javax.swing.JMenuBar menuBar
private javax.swing.JMenu fileMenu
private javax.swing.JMenuItem fileNew
private javax.swing.JMenuItem fileScores
private javax.swing.JMenuItem fileExit
private javax.swing.JMenu optionMenu
private javax.swing.JMenuItem optionDifficulty
private javax.swing.JMenuItem optionDelay
private javax.swing.JMenuItem optionLives
private javax.swing.JMenuItem optionKeyBinding
private javax.swing.JCheckBoxMenuItem optionUserKeyMap
private javax.swing.JCheckBoxMenuItem optionMouseMove
private javax.swing.JCheckBoxMenuItem optionSound
private javax.swing.JMenuItem optionVolume
private javax.swing.JCheckBoxMenuItem optionAreaChecking
private javax.swing.JMenu helpMenu
private javax.swing.JMenuItem helpReadMe
private javax.swing.JMenuItem helpVersion
private javax.swing.JMenuItem helpLicense
private javax.swing.JMenuItem helpAbout
private javax.swing.AbstractAction actionNew
private javax.swing.AbstractAction actionScores
private javax.swing.AbstractAction actionExit
private javax.swing.AbstractAction actionDifficulty
private javax.swing.AbstractAction actionDelay
private javax.swing.AbstractAction actionLives
private javax.swing.AbstractAction actionUserKeyMap
private javax.swing.AbstractAction actionMouseMove
private javax.swing.AbstractAction actionSound
private javax.swing.AbstractAction actionVolume
private javax.swing.AbstractAction actionAreaChecking
private javax.swing.AbstractAction actionKeyBinding
private javax.swing.AbstractAction actionReadMe
private javax.swing.AbstractAction actionVersion
private javax.swing.AbstractAction actionLicense
private javax.swing.AbstractAction actionAbout
private javax.swing.JButton startButton
private javax.swing.JLabel infoLabel
private javax.swing.JPanel panelAmmo
private javax.swing.JPanel infoPanel
private HighScorePanel highScorePanel
private javax.swing.ImageIcon infiniteIcon
private javax.swing.border.LineBorder selectedBorder
private java.awt.Canvas gameCanvas
private java.awt.Cursor cursorDefault
private java.awt.Cursor cursorCrosshair
private transient java.awt.Graphics2D graphicsBuffer
private transient java.awt.image.VolatileImage imageBuffer
private java.awt.Rectangle screen
private java.util.HashMap<Item.Type,ToolPanel> panelWeapon
private javax.swing.JProgressBar progressBarHealth
private javax.swing.JProgressBar progressBarShield
private javax.swing.JProgressBar progressBarBonus
private transient volatile java.lang.Thread thread
private boolean isFirstGame
private boolean isGameStarted
private boolean isRunning
private boolean isGameOver
private boolean isPacmanGame
private boolean isEatableGhost
private boolean isMouseMove
private boolean isUserKeyMap
private boolean isSound
private boolean isAreaChecking
private boolean isScreenInitialized
private int lives
private int bonus
private Ship shipPlayer
private Move mouseMove
private int level
private int playTime
private java.lang.String duration
Constructor Detail |
---|
public Javoids()
public Javoids(boolean _isApplet)
_isApplet
- is this an applet?Method Detail |
---|
public static void main(java.lang.String[] args)
args
- a list of arguments passed to the programpublic void init()
init
in class java.applet.Applet
public void start()
start
in class java.applet.Applet
public void stop()
stop
in class java.applet.Applet
public void run()
run
in interface java.lang.Runnable
private int getGameWidth()
private int getGameHeight()
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class java.awt.Container
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class java.awt.Container
public java.awt.Dimension getFrameMinimumSize()
public java.awt.Dimension getFramePreferredSize()
public void componentMoved(java.awt.event.ComponentEvent componentEvent)
componentMoved
in interface java.awt.event.ComponentListener
componentEvent
- the component's eventpublic void componentShown(java.awt.event.ComponentEvent componentEvent)
componentShown
in interface java.awt.event.ComponentListener
componentEvent
- the component's eventpublic void componentHidden(java.awt.event.ComponentEvent componentEvent)
componentHidden
in interface java.awt.event.ComponentListener
componentEvent
- the component's eventpublic void componentResized(java.awt.event.ComponentEvent componentEvent)
componentResized
in interface java.awt.event.ComponentListener
componentEvent
- the component's eventpublic void itemStateChanged(java.awt.event.ItemEvent itemEvent)
itemStateChanged
in interface java.awt.event.ItemListener
itemEvent
- the item event to handlepublic void windowOpened(java.awt.event.WindowEvent windowEvent)
windowOpened
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowClosing(java.awt.event.WindowEvent windowEvent)
windowClosing
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowClosed(java.awt.event.WindowEvent windowEvent)
windowClosed
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowActivated(java.awt.event.WindowEvent windowEvent)
windowActivated
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowDeactivated(java.awt.event.WindowEvent windowEvent)
windowDeactivated
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowIconified(java.awt.event.WindowEvent windowEvent)
windowIconified
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void windowDeiconified(java.awt.event.WindowEvent windowEvent)
windowDeiconified
in interface java.awt.event.WindowListener
windowEvent
- the window event to handlepublic void mouseEntered(java.awt.event.MouseEvent mouseEvent)
mouseEntered
in interface java.awt.event.MouseListener
mouseEvent
- the mouse event to handlepublic void mouseExited(java.awt.event.MouseEvent mouseEvent)
mouseExited
in interface java.awt.event.MouseListener
mouseEvent
- the mouse event to handlepublic void mouseClicked(java.awt.event.MouseEvent mouseEvent)
mouseClicked
in interface java.awt.event.MouseListener
mouseEvent
- the mouse event to handlepublic void mousePressed(java.awt.event.MouseEvent mouseEvent)
mousePressed
in interface java.awt.event.MouseListener
mouseEvent
- the mouse event to handlepublic void mouseReleased(java.awt.event.MouseEvent mouseEvent)
mouseReleased
in interface java.awt.event.MouseListener
mouseEvent
- the mouse event to handlepublic void mouseDragged(java.awt.event.MouseEvent mouseEvent)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseEvent
- the mouse event to handlepublic void mouseMoved(java.awt.event.MouseEvent mouseEvent)
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseEvent
- the mouse event to handlepublic void keyPressed(java.awt.event.KeyEvent keyEvent)
keyPressed
in interface java.awt.event.KeyListener
keyEvent
- the key event to handlepublic void keyReleased(java.awt.event.KeyEvent keyEvent)
keyReleased
in interface java.awt.event.KeyListener
keyEvent
- the key event to handlepublic void keyTyped(java.awt.event.KeyEvent keyEvent)
keyTyped
in interface java.awt.event.KeyListener
keyEvent
- the key event to handlepublic void menuKeyPressed(javax.swing.event.MenuKeyEvent menuKeyEvent)
menuKeyPressed
in interface javax.swing.event.MenuKeyListener
menuKeyEvent
- the menu key event to handlepublic void menuKeyReleased(javax.swing.event.MenuKeyEvent menuKeyEvent)
menuKeyReleased
in interface javax.swing.event.MenuKeyListener
menuKeyEvent
- the menu key event to handlepublic void menuKeyTyped(javax.swing.event.MenuKeyEvent menuKeyEvent)
menuKeyTyped
in interface javax.swing.event.MenuKeyListener
menuKeyEvent
- the menu key event to handlepublic void actionPerformedNew()
public void actionPerformedScores()
public void actionPerformedExit()
private java.lang.String selectValue(java.lang.String message, java.lang.String title, java.lang.Object[] values, java.lang.Object selectedValue, int targetValue)
message
- the message to display in the dialogtitle
- the title of the dialogvalues
- the values to use in the dropdown listselectedValue
- the default selected valuetargetValue
- the currently selected value
public void actionPerformedDifficulty()
public void actionPerformedDelay()
public void actionPerformedLives()
public void actionPerformedKeyBinding()
public void actionPerformedKeyMap()
public void actionPerformedMouseMove()
public void actionPerformedSound()
public void actionPerformedVolume()
public void actionPerformedAreaChecking()
public void actionPerformedReadMe()
public void actionPerformedVersion()
public void actionPerformedLicense()
public void actionPerformedAbout()
public void actionPerformed(java.awt.event.ActionEvent actionEvent)
actionPerformed
in interface java.awt.event.ActionListener
actionEvent
- the action event to handlepublic void hyperlinkUpdate(javax.swing.event.HyperlinkEvent hyperlinkEvent)
hyperlinkUpdate
in interface javax.swing.event.HyperlinkListener
hyperlinkEvent
- the hyperlink event to handlepublic void paint(java.awt.Graphics graphics)
paint
in class java.awt.Container
graphics
- the graphics context to use for drawing in the game.public void update(java.awt.Graphics graphics)
update
in class javax.swing.JApplet
graphics
- the graphics context to use for drawing in the game.public java.lang.String getAppletInfo()
getAppletInfo
in class java.applet.Applet
public java.lang.String[][] getParameterInfo()
getParameterInfo
in class java.applet.Applet
public void FileNewGame()
public void newGame()
private boolean checkSecurityUserHome()
private boolean checkSecurityHighScores()
private boolean checkSecurityKeyboard()
private boolean initializeHighScores()
public void startTimers()
public void stopGame()
public void stopTimers()
private void mouseAction(java.awt.event.MouseEvent mouseEvent)
mouseEvent
- the mouse event to handleprivate void menuItemPause()
private void menuItemUnPause()
private void pause()
private void handleGamePlay()
public void handleAction()
public void detectCollisions()
private void restoreShips()
public void moveSprites()
private void automaticActionSprites()
public void removeDead()
private void modifyShotCount()
public void drawSprites(java.awt.Graphics2D g2d, java.awt.Graphics2D foregroundImage)
g2d
- the graphics context to use in drawing.foregroundImage
- the image to draw on (used for double buffering)private <E extends BasicSprite> SpriteVector<Explosion> createExplosions(SpriteVector<E> sprites)
E
- the type of sprite creating explosionssprites
- the sprites to create explosions for.
public void createGravityPlane()
public SpriteVector<Javoid> createLevelJavoids()
private void setInformation(Ship ship, int _level)
ship
- the player's ship_level
- the game levelprivate java.lang.String formatTime(int time)
time
- the time to format
private void setAmmoInformation(Item.Type currentItem, java.util.HashMap<Item.Type,? extends Item> items)
currentItem
- the currently selected itemitems
- the list of item mappingsprivate void setDelays()
private void setDifficulty(int _difficulty)
_difficulty
- the desired difficultypublic static int getDifficulty()
private void switchPacmanGame(boolean reset)
reset
- true (use a pacman game)/false (don't use a pacman game)private void addPanelItem(Item item)
item
- the item to add to the tool panelpublic java.lang.String toString()
toString
in class java.awt.Component
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |