|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object world.World hidden.SnakeGame
public class SnakeGame
Snake Game demo
Field Summary |
---|
Fields inherited from class world.World |
---|
DEFAULT_TICK_RATE, KEY_ARROW_DOWN, KEY_ARROW_LEFT, KEY_ARROW_RIGHT, KEY_ARROW_UP, MOUSE_DOWN, MOUSE_DRAG, MOUSE_ENTER, MOUSE_LEAVE, MOUSE_MOVE, MOUSE_UP |
Method Summary | |
---|---|
Scene |
lastScene()
Returns the Scene that should be displayed when the interaction/animation completes ( World.stopWhen()
returns true). |
static void |
main(java.lang.String[] s)
|
Scene |
onDraw()
Return a visualization of this World as a Scene . |
SnakeGame |
onKey(java.lang.String ke)
Produce a (possibly) new World when a key is pressed. |
SnakeGame |
onTick()
Produce a (possibly) new World based on the Tick of the clock. |
boolean |
stopWhen()
Determine if the World/interaction/animation should be stopped. |
double |
tickRate()
Return the tick rate for this World in seconds. |
Methods inherited from class world.World |
---|
bigBang, display, onMouse, onRelease |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void main(java.lang.String[] s)
public Scene onDraw()
World
Scene
.
See EmptyScene
, Scene.placeImage(Image, int, int)
, and
Scene.addLine(int, int, int, int, String)
for documentation on
constructing Scenes
onDraw
in class World
public double tickRate()
World
tickRate
in class World
public SnakeGame onTick()
World
onTick
in class World
public SnakeGame onKey(java.lang.String ke)
World
Special Keys
"up" : | The user presses the up-arrow key |
"down" : | The user presses the down-arrow key |
"left" : | The user presses the left-arrow key |
"right" : | The user presses the right-arrow key |
onKey
in class World
public boolean stopWhen()
World
World.lastScene()
to be used to draw the final
Scene.
stopWhen
in class World
public Scene lastScene()
World
World.stopWhen()
returns true).
lastScene
in class World
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |