Package com.sprites
Class PatrolMovementSprite
- java.lang.Object
-
- com.badlogic.gdx.graphics.g2d.TextureRegion
-
- com.badlogic.gdx.graphics.g2d.Sprite
-
- com.sprites.SimpleSprite
-
- com.sprites.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 JunctiongetGoal()PatrolMovementSpritegetThis()floatgetX()floatgetY()voidsetGoal(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 setSpeedToNextCityvoidstep()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.voidupdate(com.badlogic.gdx.graphics.g2d.Batch batch)Called each frame, it updates the patrols position-
Methods inherited from class com.sprites.SimpleSprite
decreaseInternalTime, dispose, drawDebug, getCentre, getCentreX, getCentreY, getDamageHitBox, getHealthBar, getHeight, getInternalTime, getMovementHitBox, getWidth, removeSprite, resetRotation, rotate, setInternalTime, setMovementHitBox, setSize
-
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
-
-
-
-
Constructor Detail
-
PatrolMovementSprite
public PatrolMovementSprite(com.badlogic.gdx.graphics.Texture spriteTexture, MapGraph mapGraph)Constructor for PatrolMovementSprite- Parameters:
spriteTexture- The texture for the PatrolMovementSpritemapGraph- 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:
updatein classSimpleSprite- 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:
getXin classcom.badlogic.gdx.graphics.g2d.Sprite
-
getY
public float getY()
- Overrides:
getYin classcom.badlogic.gdx.graphics.g2d.Sprite
-
getGoal
public Junction getGoal()
-
getThis
public PatrolMovementSprite getThis()
-
-