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)
Increase the speed with the given vector. |
double |
getExactX()
|
double |
getExactY()
|
Vector |
getMovement()
Return the current speed. |
double |
getSpeed()
Return the speed of this actor. |
void |
move()
Move in the current movement direction. |
void |
setLocation(double x,
double y)
|
void |
setLocation(int x,
int y)
Assign a new location for this object. |
void |
stop()
Increase the speed with the given vector. |
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)
greenfoot.Actor
setLocation
in class greenfoot.Actor
x
- Location index on the x-axisy
- Location index on the y-axispublic void stop()