universe.world.test
Class FallingWorld
java.lang.Object
universe.world.World<None>
universe.world.test.FallingWorld
public class FallingWorld
- extends World<None>
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
Fields inherited from class universe.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 |
Package<None> |
onMouse(int x,
int y,
java.lang.String me)
When the mouse is dragged, we add a new random Ball |
Package<None> |
onTick()
On each tick, we apply gravity, move them, and filter out
those off screen |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
main
public static void main(java.lang.String[] s)
onDraw
public Scene onDraw()
- In order to draw the World, draw the balls into an EmptyScene
- Specified by:
onDraw
in class World<None>
onMouse
public Package<None> onMouse(int x,
int y,
java.lang.String me)
- When the mouse is dragged, we add a new random Ball
- Overrides:
onMouse
in class World<None>
onTick
public Package<None> onTick()
- On each tick, we apply gravity, move them, and filter out
those off screen
- Overrides:
onTick
in class World<None>