|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.brackeen.javagamebook.test.GameCore
se.liu.student.kimgr905.tilegame.GameManager
public final class GameManager
GameManager manages all parts of the game.
| Field Summary | |
|---|---|
private GameAction |
exit
|
private Sound |
explodeBossSound
|
private Sound |
explodeSound
|
private TileMap |
map
|
private MidiPlayer |
midiPlayer
|
private GameAction |
moveDown
|
private GameAction |
moveLeft
|
private GameAction |
moveRight
|
private GameAction |
moveUp
|
private static javax.sound.sampled.AudioFormat |
PLAYBACK_FORMAT
|
private TileMapRenderer |
renderer
|
private TileGameResourceManager |
resourceManager
|
private GameAction |
shoot
|
private SoundManager |
soundManager
|
| Fields inherited from class com.brackeen.javagamebook.test.GameCore |
|---|
FONT_SIZE, screen |
| Constructor Summary | |
|---|---|
GameManager()
|
|
| Method Summary | |
|---|---|
private void |
acquirePowerUp(PowerUp powerUp)
Gives the player the speicifed power up and removes it from the map. |
private void |
checkInput()
Checks for input. |
private Sprite |
checkPlayerCollision(Player player)
Checks if the player collidies with any sprites, and returns the colliding sprite (if any collision). |
private void |
checkShotCollision(Shot shot)
PlayerShot collision. |
void |
draw(java.awt.Graphics2D g)
Draws everything to the screen. |
java.io.InputStream |
getResourceAsStream(java.lang.String filename)
|
private Sprite |
getSpriteCollision(Sprite sprite)
Checks for sprite collison with the sprite given as argument and returns the collding sprite (if it collided), if no collision was found null is returned. |
void |
init()
Set up resources used by the GameManager. |
private void |
initInput()
|
private void |
insertShots(Ship ship)
Insert shots for the specified ship. |
private static boolean |
isCollision(Sprite s1,
Sprite s2)
Checks if two sprites collide with each other. |
javax.sound.midi.Sequence |
loadSequence(java.lang.String name)
|
Sound |
loadSound(java.lang.String name)
|
static void |
main(java.lang.String[] args)
Runs the program, arguments are ignored. |
void |
stop()
Closes any resource used by the GameManager. |
void |
update(long elapsedTime)
Updates Animation, position, and velocity of all Sprites in the current map. |
private void |
updateShip(Ship ship,
long elapsedTime)
Updates the ships x and y position, checks for collision. |
private void |
updateShot(Shot shot,
long elapsedTime)
Updates the shots x and y position, checks for collision. |
| Methods inherited from class com.brackeen.javagamebook.test.GameCore |
|---|
gameLoop, lazilyExit, loadImage, run |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private TileMap map
private TileGameResourceManager resourceManager
private TileMapRenderer renderer
private GameAction moveLeft
private GameAction moveRight
private GameAction moveUp
private GameAction moveDown
private GameAction exit
private GameAction shoot
private MidiPlayer midiPlayer
private SoundManager soundManager
private Sound explodeSound
private Sound explodeBossSound
private static final javax.sound.sampled.AudioFormat PLAYBACK_FORMAT
| Constructor Detail |
|---|
public GameManager()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
args - argumentspublic void init()
init in class GameCorepublic java.io.InputStream getResourceAsStream(java.lang.String filename)
public Sound loadSound(java.lang.String name)
public javax.sound.midi.Sequence loadSequence(java.lang.String name)
public void stop()
stop in class GameCoreprivate void initInput()
private void checkInput()
public void draw(java.awt.Graphics2D g)
draw in class GameCoreg - Graphics2Dpublic void update(long elapsedTime)
update in class GameCoreelapsedTime - the time elapsed since the last update in ms
private void updateShot(Shot shot,
long elapsedTime)
shot - shot spriteelapsedTime - the time elapsed since the last update in ms
private void updateShip(Ship ship,
long elapsedTime)
ship - ship spriteelapsedTime - the time elapsed since the last update in msprivate void insertShots(Ship ship)
ship - ship sprite
private static boolean isCollision(Sprite s1,
Sprite s2)
s1 - a sprites2 - another sprite
private Sprite getSpriteCollision(Sprite sprite)
sprite - a sprite
private Sprite checkPlayerCollision(Player player)
player - the player
private void checkShotCollision(Shot shot)
shot - player shotprivate void acquirePowerUp(PowerUp powerUp)
powerUp - a power-up sprite
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||