|
||||||||||
| 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 World| Method Detail |
|---|
public double distanceFrom(Point2D point)
Relocatable
distanceFrom in interface RelocatabledistanceFrom in class Dudpoint - the Point2D from which the distance is desired.
public void moveTo(Point2D point)
Relocatable
moveTo in interface RelocatablemoveTo in class Dudpoint - the Point2D to which the Relocatable object should move.public void act()
act in interface Animateact in class DudThatMovespublic void die()
Animate
die in interface Animatedie in class Dudpublic void pauseOrResume()
Animate
pauseOrResume in interface AnimatepauseOrResume in class Dudprotected final boolean isPaused()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||