Class Character

java.lang.Object
de.tum.cit.ase.maze.objects.GameElement
de.tum.cit.ase.maze.objects.dynamic.Character
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
Direct Known Subclasses:
Enemy, Player

public abstract class Character extends GameElement
Defines an abstract class, that describes a movable Character. Can be a Player or a NPC.
  • Field Details

    • walkTypesAnimationMap

      protected final Map<WalkDirection,com.badlogic.gdx.graphics.g2d.Animation<com.badlogic.gdx.graphics.g2d.TextureRegion>> walkTypesAnimationMap
      List of moving animations
    • deathListener

      protected final DeathListener deathListener
      Handles death of a Charter
    • ZOOM

      protected final float ZOOM
      See Also:
    • frameWidth

      protected int frameWidth
    • frameHeight

      protected int frameHeight
    • health

      protected int health
      Health of a Character
    • state

      protected State state
      State of the object.
    • walkDirectionList

      protected List<WalkDirection> walkDirectionList
      List of requested directions
    • speed

      protected float speed
      Defines the speed the Character is moving
    • stateTime

      protected float stateTime
      Time for a state
  • Constructor Details

    • Character

      public Character(com.badlogic.gdx.physics.box2d.World world, DeathListener deathListener)
  • Method Details

    • getPosition

      public com.badlogic.gdx.math.Vector2 getPosition()
      Gets position
      Returns:
      Vector2 of the position in Box2D scale. (REQUIRED to covert into pixel)
    • getTexture

      public com.badlogic.gdx.graphics.g2d.TextureRegion getTexture()
      Gets Texture.
      Returns:
      TextureRegion at the moment
    • update

      public void update(float deltaTime)
      Moves the Object
      Specified by:
      update in class GameElement
      Parameters:
      deltaTime - Time since last frame.
    • isDead

      public boolean isDead()
      Tells if Character has 0 lives;
    • getBody

      public com.badlogic.gdx.physics.box2d.Body getBody()
    • getHealth

      public int getHealth()
    • makeDamage

      public void makeDamage(int damage)
      Applies damage.
      Parameters:
      damage - damage to apply
    • heal

      public boolean heal(int amountToHeal)
      Heals the Character
      Parameters:
      amountToHeal - Health amount to restore
      Returns:
      if health was full
    • getSpeed

      public float getSpeed()
    • setSpeed

      public void setSpeed(float speed)
    • getDimensions

      public com.badlogic.gdx.math.Vector2 getDimensions()