Class MoveToAi

  • All Implemented Interfaces:, Component,

    public class MoveToAi
    extends java.lang.Object
    implements,, Component
    A component that will move the connected MovableEntity to a position. Will keep the speed but if it falsl udner a threshold will use this.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructor Description
      MoveToAi​(Point goal)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean atGoal​(float dt)
      Can the goal be reached by the next frame?
      void dispose​()
      removes itself from parent
      Point getGoal​()  
      float getMinspeed​()
      Get the value of minspeed
      boolean handleMessage​( msg)  
      void setMinspeed​(float minspeed)
      Set the value of minspeed
      void setParent​(AbstractEntity body)  
      void update​(float dt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MoveToAi

        public MoveToAi​(Point goal)
        goal -
    • Method Detail

      • getMinspeed

        public float getMinspeed​()
        Get the value of minspeed
        the value of minspeed
      • setMinspeed

        public void setMinspeed​(float minspeed)
        Set the value of minspeed
        minspeed - new value of minspeed
      • update

        public void update​(float dt)
        Specified by:
        update in interface Component
        dt -
      • atGoal

        public boolean atGoal​(float dt)
        Can the goal be reached by the next frame?
        dt - delta time in ms for this this frame
        if position is near the goal
      • handleMessage

        public boolean handleMessage​( msg)
        Specified by:
        handleMessage in interface
      • getGoal

        public Point getGoal​()
      • dispose

        public void dispose​()
        Description copied from interface: Component
        removes itself from parent
        Specified by:
        dispose in interface Component