Package com.sprites

Class PatrolMovementSprite

  • Direct Known Subclasses:
    Patrol

    public class PatrolMovementSprite
    extends SimpleSprite
    This class is the super class for Patrol and is used to move the patrol around the map. It extends SimpleSprite which gives it a damageHitbox, healthbar and allows you to rotate the patrol
    • Constructor Summary

      Constructors 
      Constructor Description
      PatrolMovementSprite​(com.badlogic.gdx.graphics.Texture spriteTexture, MapGraph mapGraph)
      Constructor for PatrolMovementSprite
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Junction getGoal()  
      PatrolMovementSprite getThis()  
      float getX()  
      float getY()  
      void setGoal​(Junction goal)
      This generates the queue of junctions the patrol will have to travel through to go from it's start position to it's goal position, once it's created a path it calls setSpeedToNextCity
      void step()
      This is called each frame and is what makes the patrol look like it is moving by updating it's x and y position by an amount set by setSpeedToNextJunction.
      void update​(com.badlogic.gdx.graphics.g2d.Batch batch)
      Called each frame, it updates the patrols position
      • Methods inherited from class com.badlogic.gdx.graphics.g2d.Sprite

        draw, draw, flip, getBoundingRectangle, getColor, getOriginX, getOriginY, getRotation, getScaleX, getScaleY, getVertices, rotate90, scale, scroll, set, setAlpha, setBounds, setCenter, setCenterX, setCenterY, setColor, setColor, setFlip, setOrigin, setOriginBasedPosition, setOriginCenter, setPackedColor, setPosition, setRegion, setRotation, setScale, setScale, setU, setU2, setV, setV2, setX, setY, translate, translateX, translateY
      • Methods inherited from class com.badlogic.gdx.graphics.g2d.TextureRegion

        getRegionHeight, getRegionWidth, getRegionX, getRegionY, getTexture, getU, getU2, getV, getV2, isFlipX, isFlipY, setRegion, setRegion, setRegion, setRegion, setRegionHeight, setRegionWidth, setRegionX, setRegionY, setTexture, split, split
      • Methods inherited from class java.lang.Object

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

      • PatrolMovementSprite

        public PatrolMovementSprite​(com.badlogic.gdx.graphics.Texture spriteTexture,
                                    MapGraph mapGraph)
        Constructor for PatrolMovementSprite
        Parameters:
        spriteTexture - The texture for the PatrolMovementSprite
        mapGraph - mapGraph that contains all the junctions in the map
    • Method Detail

      • update

        public void update​(com.badlogic.gdx.graphics.g2d.Batch batch)
        Called each frame, it updates the patrols position
        Overrides:
        update in class SimpleSprite
        Parameters:
        batch - The batch to draw onto.
      • setGoal

        public void setGoal​(Junction goal)
        This generates the queue of junctions the patrol will have to travel through to go from it's start position to it's goal position, once it's created a path it calls setSpeedToNextCity
        Parameters:
        goal - node to end up at
      • step

        public void step()
        This is called each frame and is what makes the patrol look like it is moving by updating it's x and y position by an amount set by setSpeedToNextJunction.
      • getX

        public float getX()
        Overrides:
        getX in class com.badlogic.gdx.graphics.g2d.Sprite
      • getY

        public float getY()
        Overrides:
        getY in class com.badlogic.gdx.graphics.g2d.Sprite