|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectfang.Transformer
fang.OutlineTransformer
public class OutlineTransformer
This tracker enables a path to be created from any shape or Sprite.
| Constructor Summary | |
|---|---|
OutlineTransformer(double speed,
double... vertices)
creates the tracker given a path to move on and a speed to travel. |
|
OutlineTransformer(Shape outline,
double speed)
creates the tracker given a Shape to move around and a speed to travel. |
|
OutlineTransformer(Sprite outline,
double speed)
creates the tracker given a Sprite to move around and a speed to travel. |
|
| Method Summary | |
|---|---|
void |
advance(double elapsedSeconds)
|
void |
advanceDistance(double distance)
moves along the outline a given distance. |
Location2D |
getCurrentPoint()
gets the current location along the outline. |
double |
getPathDistance()
gets the distance around the entire outline of the shape |
double |
getSpeed()
sets the speed of the tracker |
Location2D |
getTranslation()
returns (0, 0) |
boolean |
isLooping()
tells whether the tracker should stop moving once it goes all the way around the shape or if it should move continuously |
boolean |
isMoving()
|
void |
reset()
resets the tracker to the beginning of tracing the current shape/path |
void |
setLooping(boolean looping)
sets whether the tracker should stop moving once it goes all the way around the shape or if it should move continuously |
void |
setShape(double... vertices)
|
void |
setShape(Shape shape)
sets the shape to traverse |
void |
setShape(Sprite sprite)
sets the shape to traverse |
void |
setSpeed(double speed)
sets the speed of the tracker |
void |
skipDistance(double distance)
skips past a part of the outline. |
| Methods inherited from class fang.Transformer |
|---|
advance, advanceTime, getGame, getRotationAddition, getRotationAdditionDegrees, getRotationAdditionRadians, getRotationAdditionRevolutions, getScaleFactor |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public OutlineTransformer(Sprite outline,
double speed)
outline - the sprite on which to traverse the outlinespeed - the portion of the screen to move per second
public OutlineTransformer(Shape outline,
double speed)
outline - the shape on which to traverse the outlinespeed - the portion of the screen to move per second
public OutlineTransformer(double speed,
double... vertices)
speed - the portion of the screen to move per secondvertices - the location of the vertices along the path| Method Detail |
|---|
public Location2D getCurrentPoint()
public void setLooping(boolean looping)
looping - true indicates move continuously and false means stop when the
shape have bee traversed. Calling skipDistance can cause less than
the entire shape to be traversed if looping is false.public boolean isLooping()
public double getPathDistance()
public void skipDistance(double distance)
distance - the amount to skip. This can be used in conjunction with
getPathDistance.public void advanceDistance(double distance)
distance - the amount to move around the outlinepublic void setShape(Sprite sprite)
sprite - the sprite to trace the outline ofpublic void setShape(Shape shape)
shape - the shape to trace the outline ofpublic void setShape(double... vertices)
public void reset()
public boolean isMoving()
public void setSpeed(double speed)
speed - the speed of the tracker in screens per secondpublic double getSpeed()
public Location2D getTranslation()
Transformer
getTranslation in interface TrackergetTranslation in class Transformerfang.core.Tracker#getTranslation()public void advance(double elapsedSeconds)
advance in class Transformer
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||