Class FireTruck


  • public class FireTruck
    extends Entity
    Controlled by the player. Automatically fires at hostile enemies when they're within range.
    Author:
    Riju De
    • Constructor Detail

      • FireTruck

        public FireTruck​(com.badlogic.gdx.math.Vector2 spawnPos,
                         java.lang.Float[] truckStats)
        Parameters:
        spawnPos -
        truckStats -
    • 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
        Overrides:
        update in class Entity
      • 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 class GameObject
      • 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: