Class SmoothMover

java.lang.Object
  extended by greenfoot.Actor
      extended by 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
SmoothMover()
           
 
Method Summary
 double getExactX()
          Return the exact x-coordinate (as a double).
 double getExactY()
          Return the exact y-coordinate (as a double).
 void move(double distance)
          Move forward by the specified exact distance.
 void move(int distance)
          Move forward by the specified distance.
 void setLocation(double x, double y)
          Set the location using exact coordinates.
 void setLocation(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, getX, getY, intersects, setImage, setImage, setRotation, turn, turnTowards
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmoothMover

public SmoothMover()
Method Detail

move

public void move(int distance)
Move forward by the specified distance. (Overrides the method in Actor).

Overrides:
move in class greenfoot.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:
setLocation in class greenfoot.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).