[StateMachines] How granular should you make your states

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By peterhoglund

This is perhaps a more general coding question, but I have started to learn about state machines and would like to set one up for my player character.

In my case, my player can ATTACK, which would be its own state. The player can also WALK_STAIRS, which would also be a state. But the player should also be able to attack while walking in the stairs. Should this be its own state (STAIRS_ATTACK?), or should either the ATTACK or WALK_STAIRS state handle this combo?

I found this tutorial on youtube, which seems to solve this problem by simply having several state machines coexisting. https://www.youtube.com/watch?v=BQwNiU5v9as

peterhoglund | 2020-07-09 13:08