Package com.dicycat.kroy.entities
Class FireTruck
- java.lang.Object
-
- com.dicycat.kroy.GameObject
-
- com.dicycat.kroy.entities.Entity
-
- com.dicycat.kroy.entities.FireTruck
-
public class FireTruck extends Entity
Controlled by the player. Automatically fires at hostile enemies when they're within range.- Author:
- Riju De
-
-
Constructor Summary
Constructors Constructor Description FireTruck(com.badlogic.gdx.math.Vector2 spawnPos, java.lang.Float[] truckStats)
-
Method Summary
Modifier and Type Method Description void
die()
remove the FireTruck and Statbarsjava.lang.Integer
getDirection()
com.badlogic.gdx.math.Rectangle
getHitbox()
boolean
isOnCollidableTile(com.badlogic.gdx.math.Vector2 pos)
void
moveInDirection()
When called, this method moves the truck by 1 unit of movement in the direction calculated in "updateDirection()"boolean
objectInRange(GameObject object)
Check if a game object is in range of the fire truckvoid
replenish()
Replenishes health and watervoid
update()
main function of the firetruck: updates the direction in which the firetruck is moving in as well as rendering its asset, moving its hitbox and checking whether any entity is inside its rangejava.lang.Integer
updateDirection()
Method checks any arrow keys currently pressed and then converts them into a integer direction-
Methods inherited from class com.dicycat.kroy.entities.Entity
applyDamage, getHealthPoints, isAlive
-
Methods inherited from class com.dicycat.kroy.GameObject
changePosition, getCentre, getHeight, getOriginX, getOriginY, getPosition, getRotation, getSprite, getTexture, getTextureHeight, getTextureWidth, getWidth, getX, getXScale, getY, getYScale, isDisplayable, isRemove, render, setPosition, setRemove, setRotation
-
-
-
-
Method Detail
-
moveInDirection
public void moveInDirection()
When called, this method moves the truck by 1 unit of movement in the direction calculated in "updateDirection()"
-
updateDirection
public java.lang.Integer updateDirection()
Method checks any arrow keys currently pressed and then converts them into a integer direction- Returns:
- Direction to go
-
update
public void update()
main function of the firetruck: updates the direction in which the firetruck is moving in as well as rendering its asset, moving its hitbox and checking whether any entity is inside its range
-
objectInRange
public boolean objectInRange(GameObject object)
Check if a game object is in range of the fire truck- Parameters:
object
- Object to check- Returns:
- Is the object within range?
-
die
public void die()
remove the FireTruck and Statbars- Overrides:
die
in classGameObject
-
getHitbox
public com.badlogic.gdx.math.Rectangle getHitbox()
-
getDirection
public java.lang.Integer getDirection()
-
replenish
public void replenish()
Replenishes health and water
-
isOnCollidableTile
public boolean isOnCollidableTile(com.badlogic.gdx.math.Vector2 pos)
- Parameters:
pos
-- Returns:
-
-