|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectballworlds.ball.Ball
ballworlds.ball.Dud
ballworlds.ball.DudThatMoves
ballworlds.ball.Mover
public class Mover
A Mover starts in the exact middle of its world (even if its world is resized). Each Mover has its own fixed velocity that is set at random when the Mover is constructed. Additionally, the Mover is "selectable", "draggable", and "killable" by the mouse.
Constructor Summary | |
---|---|
Mover(BallEnvironment ballEnvironment)
Adds the Mover to its World at the middle of the World with the default color and diameter for a Mover, and with a constant but randomly chosen velocity. |
Method Summary | |
---|---|
void |
act()
Act unless the Mover is paused. |
void |
die()
Removes the Animate object from its World. |
double |
distanceFrom(Point2D point)
Returns the distance that the Relocatable object is from the given Point2D. |
protected boolean |
isPaused()
Returns the value of the field called 'isPaused'. |
void |
moveTo(Point2D point)
Moves the Relocatable object to the given Point2D, by setting its position (part of its Shape) to the given Point2D. |
void |
pauseOrResume()
Toggles between the "paused" and "not-paused" state. |
Methods inherited from class ballworlds.ball.DudThatMoves |
---|
getVelocity, setVelocity |
Methods inherited from class ballworlds.ball.Dud |
---|
getBallEnvironment, getColor, getDiameter, getLocation, getShape, setColor, setDiameter, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Mover(BallEnvironment ballEnvironment)
ballEnvironment
- the object that manages Balls in this WorldMethod Detail |
---|
public double distanceFrom(Point2D point)
Relocatable
distanceFrom
in interface Relocatable
distanceFrom
in class Dud
point
- the Point2D from which the distance is desired.
public void moveTo(Point2D point)
Relocatable
moveTo
in interface Relocatable
moveTo
in class Dud
point
- the Point2D to which the Relocatable object should move.public void act()
act
in interface Animate
act
in class DudThatMoves
public void die()
Animate
die
in interface Animate
die
in class Dud
public void pauseOrResume()
Animate
pauseOrResume
in interface Animate
pauseOrResume
in class Dud
protected final boolean isPaused()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |