Package model

Class Animator

java.lang.Object
model.Animator
All Implemented Interfaces:
Serializable

public class Animator extends Object implements Serializable
Implementation of Animator class, contains methods for moving the Units, and animate the attacking of Towers.
See Also:
  • Constructor Details

    • Animator

      public Animator(Entity entity)
      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

      public Entity getEntity()
      The entity to animate.
      Returns:
      The entity to animate.
    • setEntity

      public void setEntity(Entity entity)
      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

      public ArrayList<Point> getPath()
      Get the path of the animation.
      Returns:
      The path of the animation.
    • setPath

      public void setPath(ArrayList<Point> path)
      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.