|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object world.World world.test.FallingWorld
public class FallingWorld
Falling Balls Demo in World style. When the mouse is dragged, balls are created with a random upward velocity and then fall off the bottom of the screen
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 | |
---|---|
static void |
main(java.lang.String[] s)
|
Scene |
onDraw()
In order to draw the World, draw the balls into an EmptyScene |
FallingWorld |
onMouse(int x,
int y,
java.lang.String me)
When the mouse is dragged, we add a new random Ball |
FallingWorld |
onTick()
On each tick, we apply gravity, move them, and filter out those off screen |
double |
tickRate()
Set the tick rate to 25/second |
Methods inherited from class world.World |
---|
bigBang, display, lastScene, onKey, onRelease, stopWhen |
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 double tickRate()
tickRate
in class World
public Scene onDraw()
onDraw
in class World
public FallingWorld onMouse(int x, int y, java.lang.String me)
onMouse
in class World
public FallingWorld onTick()
onTick
in class World
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |