CSE115.Fly
Class MoveBehaviour
java.lang.Object
NGP.Timer
CSE115.Fly.MoveBehaviour
- All Implemented Interfaces:
- ActionListener, EventListener
- Direct Known Subclasses:
- AttractBehaviour, RandomBehaviour, RepelBehaviour
- public abstract class MoveBehaviour
- extends Timer
|
Field Summary |
protected Rectangle |
areaOfMovement
The limits within which inheriting classes move their Movables
are defined by this |
|
Constructor Summary |
MoveBehaviour(int delay,
Rectangle area)
Initializes the limiting area and inverse of speed |
|
Method Summary |
int |
getTheta(double dx,
double dy)
Returns the phase ( angle ) of a vector in degrees |
void |
placeWithinBounds(Point p,
int XJUMP,
int YJUMP,
double deltaX,
double deltaY)
Places a point which has gone off-limits within limits |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
areaOfMovement
protected Rectangle areaOfMovement
- The limits within which inheriting classes move their Movables
are defined by this
MoveBehaviour
public MoveBehaviour(int delay,
Rectangle area)
- Initializes the limiting area and inverse of speed
- Parameters:
delay - inverse of speedarea - the limiting area
placeWithinBounds
public void placeWithinBounds(Point p,
int XJUMP,
int YJUMP,
double deltaX,
double deltaY)
- Places a point which has gone off-limits within limits
- Parameters:
p - the pointXJUMP - the length of stride along XYJUMP - the length of stride along YdeltaX - X-component of vector to move alongdeltaY - Y-component of vector to move along
getTheta
public int getTheta(double dx,
double dy)
- Returns the phase ( angle ) of a vector in degrees
- Parameters:
dx - X-component of vectordy - Y-component of vector