Class SmoothMover
- java.lang.Object
-
- greenfoot.Actor
-
- SmoothMover
-
public abstract class SmoothMover extends greenfoot.ActorA variation of an actor that maintains a precise location (using doubles for the co-ordinates instead of ints). This allows small precise movements (e.g. movements of 1 pixel or less) that do not lose precision.- Version:
- 3.0
- Author:
- Poul Henriksen, Michael Kolling, Neil Brown
-
-
Constructor Summary
Constructors Constructor Description SmoothMover()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublegetExactX()Return the exact x-coordinate (as a double).doublegetExactY()Return the exact y-coordinate (as a double).voidmove(double distance)Move forward by the specified exact distance.voidmove(int distance)Move forward by the specified distance.voidsetLocation(double x, double y)Set the location using exact coordinates.voidsetLocation(int x, int y)Set the location using integer coordinates.-
Methods inherited from class greenfoot.Actor
act, addedToWorld, getImage, getIntersectingObjects, getNeighbours, getObjectsAtOffset, getObjectsInRange, getOneIntersectingObject, getOneObjectAtOffset, getRotation, getWorld, getWorldOfType, getX, getY, intersects, isAtEdge, isTouching, removeTouching, setImage, setImage, setRotation, turn, turnTowards
-
-
-
-
Method Detail
-
move
public void move(int distance)
Move forward by the specified distance. (Overrides the method in Actor).- Overrides:
movein classgreenfoot.Actor
-
move
public void move(double distance)
Move forward by the specified exact distance.
-
setLocation
public void setLocation(double x, double y)Set the location using exact coordinates.
-
setLocation
public void setLocation(int x, int y)Set the location using integer coordinates. (Overrides the method in Actor.)- Overrides:
setLocationin classgreenfoot.Actor
-
getExactX
public double getExactX()
Return the exact x-coordinate (as a double).
-
getExactY
public double getExactY()
Return the exact y-coordinate (as a double).
-
-