|
||||||||||
| 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
tipgame.GameWindow
tipgame.FrameAdvancer
tipgame.GameLoop
tipgame.game.gammacentauri.GammaCentauriLoop
public class GammaCentauriLoop
The loop that powers Gamma Centauri.
| Nested Class Summary | |
|---|---|
(package private) class |
GammaCentauriLoop.auxProcess
Implements the methods that are required for each level. |
(package private) class |
GammaCentauriLoop.StartSideMovement
Used to move the enemies when they get to the side of the screen. |
(package private) class |
GammaCentauriLoop.TimeUpdater
Updates the timer every second. |
| 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 boolean[] |
alive
The array that stores whether each player is alive or not. |
static double |
BONUS_MULTIPLIER
The number of points awarded to the player for each second under 60 times the wave number in which the wave is completed. |
private tipgame.Sprite[][] |
bullet
The player bullets. |
static double |
BULLET_SPEED_UPGRADE_MAGNITUDE
The amount by which a player's bullet speed is increased when a bullet speed upgrade is attained. |
private tipgame.game.gammacentauri.tracker.BulletTracker[][] |
bulletTracker
The player bullet trackers. |
double[] |
bulletVelocity
The array that holds the players' bullet velocities. |
private static java.net.URL |
CLIP_FILE
The location of the sound to be played when an enemy is killed. |
private static java.net.URL |
CLIP_FILE2
The location of the sound to be played when the player gets an upgrade. |
private static java.net.URL |
CLIP_FILE3
The location of the sound to be played in between levels. |
private int[] |
currentBullet
The current bullet that the player is firing. |
private int[] |
currentBulletCount
The current amount of bullets that the player can have on the screen at one time. |
private long |
desiredScore
The score required to clear each wave. |
static tipgame.Sprite[][] |
enemy
The enemy sprites. |
static java.awt.geom.Rectangle2D.Double |
ENEMY_BOX
The location and size of the box that defines the enemies' positions. |
static double |
ENEMY_BULLET_VELOCITY
The velocity of the enemies' bullets. |
static double |
ENEMY_BULLET_WIDTH
The width of the enemies' bullets. |
static double |
ENEMY_HORIZONTAL_VELOCITY
The horizontal velocity of the enemies' ships. |
static double |
ENEMY_MOVE_DOWN_TIME
The number of seconds that the enemies move down for each time one of them hits the edge of the screen. |
static double |
ENEMY_SHOOT_PROBABILITY
The probability that an enemy will shoot every time frame. |
static int |
ENEMY_TYPE_ONE_HEALTH
The amount of damage an enemy of type one can sustain before being killed. |
static double |
ENEMY_TYPE_ONE_POINTS
The number of points awarded to the player for killing an enemy of type one. |
static double |
ENEMY_TYPE_THREE_BULLET_VELOCITY
The velocity of the bullets of enemies of type three. |
static int |
ENEMY_TYPE_THREE_HEALTH
The amount of damage an enemy of type three can sustain before being killed. |
static double |
ENEMY_TYPE_THREE_POINTS
The number of points awarded to the player for killing an enemy of type three. |
static int |
ENEMY_TYPE_TWO_HEALTH
The amount of damage an enemy of type two can sustain before being killed. |
static double |
ENEMY_TYPE_TWO_POINTS
The number of points awarded to the player for killing an enemy of type two. |
static double |
ENEMY_VERTICAL_VELOCITY
The vertical velocity of the enemies' ships. |
static double |
ENEMY_WIDTH
The width of the enemies' ships. |
private tipgame.Sprite[][] |
enemyBullet
The enemy bullets. |
private tipgame.game.gammacentauri.tracker.EnemyBulletTracker[][] |
enemyBulletTracker
The enemy bullet trackers. |
private int[][][] |
enemyGrid
The grid used to define enemy types and locations on the screen. |
private int[][] |
enemyHealth
The health of the enemies. |
static tipgame.game.gammacentauri.tracker.EnemyTracker[][] |
enemyTracker
The enemy trackers. |
private static double |
EPSILON
Used to combat round-off errors. |
(package private) java.applet.AudioClip |
impactClip
The sound to be played when an enemy is killed. |
private boolean |
inBetweenLevels
Whether or not the player is currently in between waves. |
static double |
INITAL_BULLET_VELOCITY
The initial velocity of the players' bullets. |
static int |
INITIAL_BULLET_COUNT
The maximum number of bullets the player can have on the screen at one time. |
private int[] |
laserDamage
The damage the player's laser deals to the enemies. |
static double |
LEVEL_DELAY
The time (in seconds) in between levels. |
(package private) java.applet.AudioClip |
levelClip
The sound to be played in between levels. |
static int |
MAX_BULLET_COUNT
The maximum number of bullets the player can have on the screen at one time. |
static double |
MAX_VELOCITY
The maximum velocity of the player's ship. |
(package private) java.applet.AudioClip |
moneyClip
The sound to be played when the player gets an upgrade. |
static int |
NUM_POSSIBLE_UPGRADES
The number of upgrades that are attainable. |
static double |
PAR_TIME_PER_LEVEL
The number of seconds at which the player receieves no bonus points for completing the wave. |
static double |
PLAYER_BULLET_WIDTH
The width of the player's bullets. |
private long[] |
score
The player's current score. |
static java.awt.geom.Point2D.Double |
SCORE_LOCATION
The location of the score. |
static double |
SCORE_SIZE_X
The width of the score. |
private tipgame.sprite.StringSprite |
scoreSprite
The sprite for the player's current score. |
static int |
SHIELD_UPGRADE_MAGNITUDE
The amount by which the player's shields are increased when getting a shield upgrade. |
private int[] |
shields
The player's current shields. |
static java.awt.geom.Point2D.Double |
SHIELDS_LOCATION
The location of the shields. |
static double |
SHIELDS_SIZE_X
The width of the shields sprite. |
private tipgame.sprite.StringSprite |
shieldsSprite
The sprite for the player's current shields. |
static tipgame.Sprite[] |
ship
The ship sprites. |
static double |
SHIP_SIDE_LENGTH
The side length of the player's ship. |
static java.awt.geom.Point2D.Double |
SHIP_START
The starting location of the player's ship. |
private tipgame.game.gammacentauri.tracker.ShipTracker[] |
shipTracker
The ship trackers. |
private boolean[] |
spread
The array that stores whether each player has the spread shot upgrade or not. |
static int |
STARTING_LASER_DAMAGE
The amount of damage the player's laser does at the start of the game. |
static int |
STARTING_SHIELDS
The amount of shields each player starts with. |
private double |
timeOffset
Used to reset the timer when the game is restarted. |
private tipgame.sprite.StringSprite |
timer
The timer sprite. |
static java.awt.geom.Point2D.Double |
TIMER_LOCATION
The location of the timer. |
static double |
TIMER_SIZE_X
The width of the timer. |
private tipgame.Sprite[][] |
upgrade
The upgrade sprites. |
static double |
UPGRADE_DROP_PROBABILITY
The probability that an upgrade will drop when an enemy is killed. |
static double |
UPGRADE_VELOCITY
The velocity of the upgrades. |
static double |
UPGRADE_WIDTH
The width of the upgrades. |
private int[][] |
upgradeGrid
The array that stores the upgrades hidden within the enemies. |
private tipgame.game.gammacentauri.tracker.EnemyBulletTracker[][] |
upgradeTracker
The upgrade trackers. |
private int |
wave
The current wave the player is on. |
static java.awt.geom.Point2D.Double |
WAVE_LOCATION
The location of the wave indicator. |
static double |
WAVE_SIZE_X
The width of the wave indicator sprite. |
private tipgame.sprite.StringSprite |
waveSprite
The wave indicator sprite. |
| Fields inherited from class tipgame.GameLoop |
|---|
messages, playerKeyboard, playerMouse, random, SEED |
| Fields inherited from class tipgame.FrameAdvancer |
|---|
canvas, timeInterval |
| Fields inherited from class tipgame.GameWindow |
|---|
frame, gameLoop, hasFrame, help |
| 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 | |
|---|---|
GammaCentauriLoop()
Constructs the game. |
|
| Method Summary | |
|---|---|
void |
addBullets()
Adds each bullet to the canvas. |
void |
addEnemies()
Adds the enemy sprites to the canvas. |
void |
addEnemyBullets()
Adds the enemy bullet sprites to the canvas. |
private void |
addScore()
Adds the score to the canvas. |
private void |
addShields()
Adds the shields sprite to the canvas. |
void |
addShips()
Adds each ship to the canvas. |
private void |
addTimer()
Adds the timer to the canvas. |
void |
addUpgrades()
Adds the upgrade sprites to the canvas. |
private void |
addWave()
Adds the wave indicator to the canvas. |
void |
advanceFrame()
called repeatedly between every model update |
void |
advanceLevel()
Advances to the next wave. |
void |
checkEnemyBullets()
Checks the position of each enemy bullet and resets it if it goes off the canvas. |
void |
checkWin()
Checks to see if the player has enough points to advance to the next level. |
void |
fireBullets()
Fires a bullet if the player presses "/" and the player has bullets remaining. |
void |
fireEnemyBullets()
Fires all of the enemy bullets that need to be fired. |
protected java.net.URL |
getHelpURL()
this method must be overridden when extending the GameWindow. |
void |
giveBonusPoints()
Gives bonus points to the player based on the time it took to complete the wave. |
void |
handleCollisions()
Handles collisions between player bullets and enemies and between enemy bullets and the players. |
void |
makeBullets()
Creates a number of bullets for each player equal to MAX_BULLET_COUNT. |
void |
makeBulletTrackers()
Creates a tracker for each bullet. |
void |
makeEnemies()
Creates enemies by reading enemyGrid[][][]. |
void |
makeEnemyBullets()
Creates a bullet for each enemy. |
void |
makeEnemyBulletTrackers()
Creates a bullet tracker for each enemy bullet. |
void |
makeEnemyHealth()
Assigns the appropriate amount of health to each enemy. |
void |
makeEnemyTrackers()
Creates a tracker for each enemy. |
private void |
makeScore()
Creates the string sprite and sets its scale and location. |
private void |
makeShields()
Creates the shields sprite and sets its scale and location. |
void |
makeShips()
Creates a ship for each player and sets its scale, location, and color. |
void |
makeShipTrackers()
Creates a tracker for each ship. |
private void |
makeSoundClips()
Creates the sounds clips. |
private void |
makeTimer()
Creates the timer sprite and sets its scale and location. |
void |
makeUpgradeGrid()
Constructs the grid that holds the upgrades hidden within each enemy. |
void |
makeUpgrades()
Creates the upgrade sprites. |
void |
makeUpgradeTrackers()
Creates the upgrade trackers. |
private void |
makeWave()
Creates the wave indicator sprite and sets its scale and location. |
void |
moveEnemies()
Changes the velocity of all of the enemies if one of them hits an edge of ENEMY_BOX. |
void |
moveShips()
Changes the velocity of each ship based on the keyboard input. |
void |
startGame()
starts game |
| Methods inherited from class tipgame.GameLoop |
|---|
connect, disconnect, getID, isMuted, isPaused, pauseToggle, postAdvanceFrame, sendMessage, setGameName, setNumberOfPlayers, setServerName, setSessionName, start, toggleAudible |
| Methods inherited from class tipgame.FrameAdvancer |
|---|
cancelAlarm, clearAllAlarms, getCanvas, getScreenRefreshRate, getTime, refreshScreen, scheduleAbsolute, scheduleRelative, setCanvas, setMinimumModelFrameRate, updateModel |
| Methods inherited from class tipgame.GameWindow |
|---|
actionPerformed, getDefaultSize, init, runAsApplication, setTitle, setUseFrame, stop, windowStateChanged |
| Methods inherited from class javax.swing.JApplet |
|---|
addImpl, createRootPane, getAccessibleContext, getContentPane, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, remove, setContentPane, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update |
| Methods inherited from class java.applet.Applet |
|---|
destroy, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus |
| Methods inherited from class java.awt.Panel |
|---|
addNotify |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private static final double EPSILON
public static final double SHIP_SIDE_LENGTH
public static final int STARTING_SHIELDS
public static final int STARTING_LASER_DAMAGE
public static final double UPGRADE_WIDTH
public static final java.awt.geom.Point2D.Double SHIP_START
public static final double MAX_VELOCITY
public static final double UPGRADE_VELOCITY
public static final int MAX_BULLET_COUNT
public static final int INITIAL_BULLET_COUNT
public static final double PLAYER_BULLET_WIDTH
public static final double ENEMY_BULLET_WIDTH
public static final double INITAL_BULLET_VELOCITY
public double[] bulletVelocity
public static final double ENEMY_BULLET_VELOCITY
public static final java.awt.geom.Rectangle2D.Double ENEMY_BOX
public static final double ENEMY_WIDTH
public static final double ENEMY_MOVE_DOWN_TIME
public static final double ENEMY_VERTICAL_VELOCITY
public static final double ENEMY_HORIZONTAL_VELOCITY
public static final double ENEMY_SHOOT_PROBABILITY
public static final double ENEMY_TYPE_THREE_BULLET_VELOCITY
public static final double ENEMY_TYPE_ONE_POINTS
public static final double ENEMY_TYPE_TWO_POINTS
public static final double ENEMY_TYPE_THREE_POINTS
public static final double PAR_TIME_PER_LEVEL
public static final double BONUS_MULTIPLIER
public static final int ENEMY_TYPE_ONE_HEALTH
public static final int ENEMY_TYPE_TWO_HEALTH
public static final int ENEMY_TYPE_THREE_HEALTH
public static final java.awt.geom.Point2D.Double TIMER_LOCATION
public static final double TIMER_SIZE_X
public static final java.awt.geom.Point2D.Double SCORE_LOCATION
public static final double SCORE_SIZE_X
public static final java.awt.geom.Point2D.Double SHIELDS_LOCATION
public static final double SHIELDS_SIZE_X
public static final java.awt.geom.Point2D.Double WAVE_LOCATION
public static final double WAVE_SIZE_X
public static final double LEVEL_DELAY
public static final double BULLET_SPEED_UPGRADE_MAGNITUDE
public static final int NUM_POSSIBLE_UPGRADES
public static final double UPGRADE_DROP_PROBABILITY
public static final int SHIELD_UPGRADE_MAGNITUDE
private static final java.net.URL CLIP_FILE
private static final java.net.URL CLIP_FILE2
private static final java.net.URL CLIP_FILE3
private tipgame.sprite.StringSprite scoreSprite
private tipgame.sprite.StringSprite shieldsSprite
private int[] shields
private long[] score
private long desiredScore
private boolean inBetweenLevels
private int wave
private int[] currentBulletCount
private double timeOffset
private int[] laserDamage
java.applet.AudioClip impactClip
java.applet.AudioClip moneyClip
java.applet.AudioClip levelClip
private tipgame.sprite.StringSprite timer
private tipgame.sprite.StringSprite waveSprite
public static tipgame.Sprite[] ship
private tipgame.game.gammacentauri.tracker.ShipTracker[] shipTracker
private tipgame.Sprite[][] bullet
private tipgame.game.gammacentauri.tracker.BulletTracker[][] bulletTracker
private int[] currentBullet
private int[][][] enemyGrid
public static tipgame.Sprite[][] enemy
public static tipgame.game.gammacentauri.tracker.EnemyTracker[][] enemyTracker
private tipgame.Sprite[][] enemyBullet
private int[][] enemyHealth
private tipgame.game.gammacentauri.tracker.EnemyBulletTracker[][] enemyBulletTracker
private int[][] upgradeGrid
private tipgame.Sprite[][] upgrade
private tipgame.game.gammacentauri.tracker.EnemyBulletTracker[][] upgradeTracker
private boolean[] alive
private boolean[] spread
| Constructor Detail |
|---|
public GammaCentauriLoop()
| Method Detail |
|---|
public void startGame()
tipgame.GameLoop
startGame in class tipgame.GameLoopprivate void makeTimer()
private void addTimer()
private void makeShields()
private void addShields()
private void makeScore()
private void addScore()
private void makeWave()
private void addWave()
private void makeSoundClips()
public void makeShips()
public void makeShipTrackers()
public void makeBullets()
public void makeBulletTrackers()
public void addBullets()
public void addShips()
public void moveShips()
public void fireBullets()
public void makeEnemyHealth()
public void makeEnemies()
public void makeEnemyTrackers()
public void makeUpgradeGrid()
public void makeUpgrades()
public void makeUpgradeTrackers()
public void addUpgrades()
public void addEnemies()
public void addEnemyBullets()
public void makeEnemyBullets()
public void makeEnemyBulletTrackers()
public void fireEnemyBullets()
public void moveEnemies()
public void handleCollisions()
public void checkEnemyBullets()
public void giveBonusPoints()
public void advanceLevel()
public void checkWin()
public void advanceFrame()
tipgame.FrameAdvancer
advanceFrame in class tipgame.FrameAdvancerprotected java.net.URL getHelpURL()
tipgame.GameWindow
getHelpURL in class tipgame.GameWindow
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||