java.lang.Objectgreenfoot.Actor
SmoothMover
public abstract class SmoothMover
A variation of an actor that maintains precise location (using doubles for the co-ordinates instead of ints). It also maintains a current movement in form of a movement vector.
Constructor Summary | |
---|---|
SmoothMover()
|
|
SmoothMover(Vector movement)
Create new thing initialised with given speed. |
Method Summary | |
---|---|
void |
accelerate(double factor)
Accelerate the speed of this mover by the given factor. |
void |
addForce(Vector force)
Modify the current movement by adding a new vector to the existing movement. |
double |
getExactX()
Return the exact x co-ordinate (as a double). |
double |
getExactY()
Return the exact y co-ordinate (as a double). |
Vector |
getMovement()
Return the current movement of this object (as a vector). |
double |
getSpeed()
Return the speed of this actor. |
void |
move()
Move in the current movement direction. |
void |
setLocation(double x,
double y)
Set the location using exact (double) co-ordinates. |
void |
setLocation(int x,
int y)
Set location. |
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 movement)
Method Detail |
---|
public void accelerate(double factor)
public void addForce(Vector force)
public double getExactX()
public double getExactY()
public Vector getMovement()
public double getSpeed()
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