Class Path

  • All Implemented Interfaces:
    IRender

    public final class Path
    extends java.lang.Object
    implements IRender
    This class is used to define, manage, and traverse a path (defined by a series of 2D vectors)
    Author:
    kong
    • Constructor Summary

      Constructors 
      Constructor Description
      Path()  
      Path​(int numWaypoints, float minX, float minY, float maxX, float maxY, boolean looped)  
    • Constructor Detail

      • Path

        public Path()
      • Path

        public Path​(int numWaypoints,
                    float minX,
                    float minY,
                    float maxX,
                    float maxY,
                    boolean looped)
    • Method Detail

      • getCurrentWayPoint

        public Vector2 getCurrentWayPoint()
        Returns:
        the current way-point, see Vector2
      • isEndOfWayPoints

        public boolean isEndOfWayPoints()
        Returns:
        true if the end of the list has been reached, false otherwise
      • setToNextWayPoint

        public void setToNextWayPoint()
        Moves the iterator on to the next way-point in the list
      • createRandomPath

        public java.util.List<Vector2> createRandomPath​(int numWaypoints,
                                                        float minX,
                                                        float minY,
                                                        float maxX,
                                                        float maxY)
      • enableLoop

        public void enableLoop​(boolean enabled)
      • setWayPoints

        public void setWayPoints​(java.util.List<Vector2> wayPoints)
        Adds a way-point to the end of the path methods for setting the path with either another path or a list of vectors
        Parameters:
        wayPoints - list of way-points
      • setPath

        public void setPath​(Path path)
      • clear

        public void clear()
      • getWayPoints

        public java.util.List<Vector2> getWayPoints()
      • render

        public void render​(Paint paint)
        Description copied from interface: IRender
        To render objects to screen
        Specified by:
        render in interface IRender
        Parameters:
        paint - see Paint