Final Boss Animation - UQdeco2800/2022-studio-1 GitHub Wiki
Navigation / Quick Links
- Introduction
- Target audience analysis
- Justification for existence
- User Testing Design
- Low fidelity sketches
- User Testing “Typhon”
- Animation <--You're Here
- Appendix
Implementation
Animation was implemented using the information found in the base game engine wiki. Animations for the final boss are controlled using the BossAnimationController
, which inherits from Component
and implements an animation depending on the direction the boss is facing. Because animations were implemented for side-on views only, and it can be safely assumed the boss will always travel towards the crystal, implementation of this controller was very straightforward.
On creation, BossAnimationController
takes an Entity as its target. The boss will be animated facing left or right, depending on which direction is closer to facing the target. The direction vector of movement towards the entity is found (using getPosition()
for both entities), then converted to a unit vector. The x and y components of that unit vector are then added, and the boss is animated facing right if the result > 0, and left if the result is < 0. Diagram below demonstrates how this works (pink is negative, green is positive)
In future, the controller could be adjusted to respond to events triggered by the movementTasks, however this logic was appraised to be unnecessarily complicated for the desired functionality. It could also be possible in future work to set it up so that the animation occurs only when the boss is attacking (see ContinuousAttackComponent
here)