java.lang.Object
de.tum.cit.fop.maze.objects.GameObject
de.tum.cit.fop.maze.objects.Dynamic.Enemy.Enemy
All Implemented Interfaces:
Enemies
Direct Known Subclasses:
Bouncer, Junkie, Tourist

public abstract class Enemy extends GameObject implements Enemies
Base enemy class with AI behavior, death handling, and collision detection.
  • Field Details

    • isDead

      protected boolean isDead
  • Constructor Details

    • Enemy

      public Enemy(com.badlogic.gdx.math.Vector2 startPos, AnimationType animationType)
  • Method Details

    • updateBehavior

      public void updateBehavior(float deltaTime, com.badlogic.gdx.math.Vector2 playerPosition, GameField gameField, Player player)
      Updates enemy behavior including chasing and idle states.
      Parameters:
      deltaTime - Time since last update
      playerPosition - Player's current position
      gameField - Game field for navigation
      player - Player reference
    • updateDeathAnimation

      public void updateDeathAnimation(float delta)
      Updates death animation fade timer.
      Parameters:
      delta - Time since last update
    • shouldRemove

      public boolean shouldRemove()
      Checks if enemy should be removed after death.
      Returns:
      True if fade animation is complete
    • WallOrObstacle

      protected boolean WallOrObstacle(float x, float y, com.badlogic.gdx.math.Vector2 size, GameField gameField)
    • onDeath

      public Collectable onDeath(Player player)
      Handles enemy death rewards and collectables.
      Parameters:
      player - The player who killed the enemy
      Returns:
      Collectable drop
    • animate

      public void animate(com.badlogic.gdx.graphics.g2d.Batch batch)
      Description copied from class: GameObject
      Renders the object using its drawable or texture.
      Overrides:
      animate in class GameObject
      Parameters:
      batch - Sprite batch for rendering
    • isDead

      public boolean isDead()
      Checks if enemy is dead.
      Returns:
      True if dead
    • setDead

      public void setDead(boolean dead)
      Sets enemy death state.
      Parameters:
      dead - New death state
    • getEnemyEntity

      public GameObject getEnemyEntity()
      Gets enemy as GameObject.
      Returns:
      This enemy instance
    • getPosition

      public com.badlogic.gdx.math.Vector2 getPosition()
      Gets enemy position.
      Returns:
      Position vector