|
||||||||||
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
public class DudThatMoves
A DudThatMoves behaves exactly like a Dud (including random location), except that it moves, on its own, in a straight line (i.e., a constant velocity).
Constructor Summary | |
---|---|
DudThatMoves(BallEnvironment ballEnvironment)
Adds the DudThatMoves to its World at a random location with the default color and diameter for a DudThatMoves, and with a constant velocity. |
Method Summary | |
---|---|
void |
act()
Move the DudThatMoves per its constant velocity. |
protected Point2D |
getVelocity()
Returns the value of the field called 'velocity'. |
protected void |
setVelocity(Point2D velocity)
Sets the field called 'velocity' to the given value. |
Methods inherited from class ballworlds.ball.Dud |
---|
die, distanceFrom, getBallEnvironment, getColor, getDiameter, getLocation, getShape, moveTo, pauseOrResume, setColor, setDiameter, setLocation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DudThatMoves(BallEnvironment ballEnvironment)
ballEnvironment
- the object that manages Balls in this WorldMethod Detail |
---|
public void act()
act
in interface Animate
act
in class Dud
protected void setVelocity(Point2D velocity)
velocity
- The velocity to set.protected Point2D getVelocity()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |