Skip to content

Implement state flow for animations #142

@dmin12

Description

@dmin12

This is currently just a place for me to write down some notes before I forget. Any feedback is appreciated!

Currently, animations are set for each player based on certain actions: for example, using a weapon will trigger an attack animation, pressing space will trigger a jump animation, etc. However, the current implementation of this functionality relies on setting the player's AnimState upon receiving an Event, meaning that if, for example, the player presses WASD while in the "jumping" animation, then the model will begin walking, despite still being airborne. Another symptom of this is that animations such as "attacking" or "drinking a potion" will loop indefinitely until another input is received.

The approach I will attempt to implement is to maintain a sort of state machine for the character's current actions, and only transition between animations under valid conditions. Not only will this remedy the issues described above, but it will also make it easier to play transitional animations and smoothen the overall graphics of the game. The state machine will accept different events and actions and output the correct animation to be played at any given time.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions