Skip to content

Mobs Animation Controller

cindyle1 edited this page Oct 19, 2023 · 2 revisions

Introduction

The Projectile Animation Controller is responsible for animating the phases of a projectile. This component is called in the 'TrajectTask' by calling START using trigger(). The animations are packed using GDXTexture Packer to create an atlas. A new class, 'ProjectileAnimationController' is made to start the picture called. Then, the animations are ran by the 'AnimationRenderComponent' through 'startAnimation' method.

The following UML diagram gives a hierarchical overview of how ProjectileAnimationController links with other components: ProjectileAnimationController

Initialiser: create()

This method configures the AnimationRenderComponent animator; variable to refer to the AnimationRenderComponent present in the same entity as this component, by running animator = this.entity.getComponent(AnimationRenderComponent.class);

It further proceeds to add listeners for the tower's animation triggers as follows:

entity.getEvents().addListener(START, this::animateStart);
entity.getEvents().addListener(FINAL, this::animateFinal);

Animators: animate[ANIMATION-NAME]()

The animator methods for this class are as follows:

void animateStart();
void animateFinal();
Clone this wiki locally