java.lang.Objectgreenfoot.Actor
SmoothMover
public abstract class SmoothMover
A superclass for specific actor classes that add smooth movement functionality. Movement is based on doubles (rather than ints), and thus generates smoother movement for fast moving actors in high resolution worlds. The SmoothMover also implements world wrap-around: when moving out of the world at any edge, the actor will enter again at the opposite side. Requires class Vector.
Constructor Summary | |
---|---|
SmoothMover()
|
|
SmoothMover(Vector speed)
Create new thing initialised with given speed. |
Method Summary | |
---|---|
Vector |
getSpeed()
Return the current speed. |
void |
increaseSpeed(Vector s)
Increase the speed with the given vector. |
void |
move()
Move forward one step. |
void |
setLocation(double x,
double y)
Providing 'setLocation' based on doubles. |
void |
setLocation(int x,
int y)
Override the default 'setLocation' method to keep our own coordinates up-to-date. |
Methods inherited from class greenfoot.Actor |
---|
act, addedToWorld, getHeight, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWidth, getWorld, getX, getY, intersects, setImage, setImage, setRotation |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SmoothMover()
public SmoothMover(Vector speed)
Method Detail |
---|
public Vector getSpeed()
public void increaseSpeed(Vector s)
public void move()
public void setLocation(double x, double y)
public void setLocation(int x, int y)
setLocation
in class greenfoot.Actor
x
- Location index on the x-axisy
- Location index on the y-axis