|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfrog.demo.DemoController
public class DemoController
The DemoController manages all Sprites and sound in the game. After the initial DemoGame window has been set up, it uses DemoController to run the game. After DemoController has been created, DemoGame's only job will be to ensure that the requested FPS is maintained and that special keyboard events are handled (such as mute).
| Field Summary | |
|---|---|
static int |
CIRCLE
Shape recognized in this game. |
(package private) boolean |
enableSound
Determines if sound should be enabled or not. |
static int |
SQUARE
Shape recognized in this game. |
static int |
TRIANGLE
Shape recognized in this game. |
static int |
X
Shape recognized in this game. |
static int |
Z
Shape recognized in this game. |
| Constructor Summary | |
|---|---|
DemoController(DemoGame game)
Creates a new DemoController for the instance of DemoGame. |
|
| Method Summary | |
|---|---|
void |
draw(Graphics g)
Calls the draw method on all sprites after painting the background. |
void |
killUFO(int type,
int player)
Creates a new KillEvent for a given player on a given UFO. |
protected void |
notifyAbduction(CowSprite cow)
Allows the controller to put the abducted cow to a special queue. |
protected void |
notifyDeadUFO()
A UFO has finished exploding and needs to be removed from the ufoDeath queue. |
protected void |
notifyRelease(CowSprite cow)
Notifies the controller of the release of a cow from the hold of a UFO. |
protected void |
removeCow(CowSprite cow)
Completely removes the given CowSprite from the game. |
protected void |
removeUFO(UFOSprite ufo)
Removes a UFO from the game and decrements the total UFO count by 1. |
void |
update()
Calls the update method of each Sprite which should in turn move one step across the screen. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int CIRCLE
public static final int SQUARE
public static final int TRIANGLE
public static final int X
public static final int Z
boolean enableSound
| Constructor Detail |
|---|
public DemoController(DemoGame game)
game - the reference to the DemoGame that this controller is a part of| Method Detail |
|---|
public final void draw(Graphics g)
g - the Graphics context to draw to.
public void killUFO(int type,
int player)
type - the type of UFO to destroy. Could be CIRCLE, TRIANGLE, etc.player - the Player to give the kill points to.protected void notifyAbduction(CowSprite cow)
cow - the CowSprite that needs to be modified.protected void notifyDeadUFO()
protected void notifyRelease(CowSprite cow)
cow - the CowSprite that was released.protected void removeCow(CowSprite cow)
cow - the CowSprite to remove from the game.protected void removeUFO(UFOSprite ufo)
ufo - the UFOSprite to destroy.public final void update()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||