Class SmoothMover
java.lang.Object
greenfoot.Actor
SmoothMover
public abstract class SmoothMover
extends greenfoot.Actor
A 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 -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturn the exact x-coordinate (as a double).doubleReturn 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, sleepFor, turn, turnTowards
-
Constructor Details
-
SmoothMover
public SmoothMover()
-
-
Method Details
-
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).
-