world.test
Class FallingWorld

java.lang.Object
  extended by world.World
      extended by world.test.FallingWorld

public class FallingWorld
extends World

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

main

public static void main(java.lang.String[] s)

tickRate

public double tickRate()
Set the tick rate to 25/second

Overrides:
tickRate in class World

onDraw

public Scene onDraw()
In order to draw the World, draw the balls into an EmptyScene

Specified by:
onDraw in class World

onMouse

public FallingWorld 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

onTick

public FallingWorld onTick()
On each tick, we apply gravity, move them, and filter out those off screen

Overrides:
onTick in class World