Package model
Class Animator
java.lang.Object
model.Animator
- All Implemented Interfaces:
Serializable
Implementation of Animator class, contains methods for moving the Units, and animate the attacking of Towers.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
animate()
Animate an entity.The entity to animate.int
getFrame()
Gets the sprite frame number.getPath()
Get the path of the animation.double
getX()
The next point x coordinate to move to.double
getY()
The next point y coordinate to move to.void
Remove the path of the animation.void
Set the entity to animate.void
Set the path of the animation.void
setSecond
(double second) Set the time it takes to travel 1 block.void
setSeconds
(double second) Sets the second variable to the time it takes to travel 1 block.void
setSpeedModifier
(double speedModifier) Set the speed modifier.void
setSteps
(int steps) Set the steps of the animation.void
setX
(double x) Set the next point x coordinate to move to.void
setY
(double y) Set the next point y coordinate to move to.void
Start the animation.void
Stop the animation.
-
Constructor Details
-
Animator
Constructor for Animator class.- Parameters:
entity
- The animated Entity.
-
Animator
public Animator()Constructor for Animator class loaded from JSON.
-
-
Method Details
-
setSeconds
public void setSeconds(double second) Sets the second variable to the time it takes to travel 1 block.- Parameters:
second
- The time it takes to travel 1 block.
-
getX
public double getX()The next point x coordinate to move to.- Returns:
- The next point x coordinate to move to.
-
setX
public void setX(double x) Set the next point x coordinate to move to.- Parameters:
x
- The next point x coordinate to move to.
-
getEntity
The entity to animate.- Returns:
- The entity to animate.
-
setEntity
Set the entity to animate.- Parameters:
entity
- The entity to animate.
-
getY
public double getY()The next point y coordinate to move to.- Returns:
- The next point y coordinate to move to.
-
setY
public void setY(double y) Set the next point y coordinate to move to.- Parameters:
y
- The next point y coordinate to move to.
-
setSecond
public void setSecond(double second) Set the time it takes to travel 1 block.- Parameters:
second
- The time it takes to travel 1 block.
-
setSteps
public void setSteps(int steps) Set the steps of the animation.- Parameters:
steps
- The steps of the animation
-
startAnimation
public void startAnimation()Start the animation. -
stopAnimation
public void stopAnimation()Stop the animation. -
getPath
Get the path of the animation.- Returns:
- The path of the animation.
-
setPath
Set the path of the animation.- Parameters:
path
- The path of the animation.
-
removePath
public void removePath()Remove the path of the animation. -
animate
public void animate()Animate an entity. -
getFrame
public int getFrame()Gets the sprite frame number.- Returns:
- frame.
-
setSpeedModifier
public void setSpeedModifier(double speedModifier) Set the speed modifier.- Parameters:
speedModifier
- The speed modifier.
-