Class AnimalAnimationController

java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.components.npc.AnimalAnimationController
All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
Direct Known Subclasses:
HostileAnimationController

public class AnimalAnimationController extends Component
This class listens to events relevant to a chicken entity's state and plays the animation when one of the events is triggered.
  • Field Details

    • WALK_PREFIX

      protected static final String WALK_PREFIX
      Walk prefix to play walk animation
      See Also:
    • RUN_PREFIX

      protected static final String RUN_PREFIX
      Run prefix to play run animation
      See Also:
    • IDLE_PREFIX

      protected static final String IDLE_PREFIX
      Idle prefix to play idle animation
      See Also:
    • animator

      protected AnimationRenderComponent animator
      Render component used to render animals.
    • direction

      protected String direction
      Current direction of animal.
    • currentAnimation

      protected String currentAnimation
      Current animation playing (excluding direction suffix)
  • Constructor Details

    • AnimalAnimationController

      public AnimalAnimationController()
  • Method Details

    • create

      public void create()
      Create component by retrieving animator, setting start direction and animation, and adding event listeners.
      Overrides:
      create in class Component
    • animateWalk

      protected void animateWalk()
      Play walk animation with current direction
    • animateRun

      protected void animateRun()
      Play run animation with current direction
    • animateIdle

      protected void animateIdle()
      Play idle animation with current direction