Would a State Machine make sense for a Run and Gun project?

Godot Version



The project in mind is inspired by Metal Slug, where the character is able to stand+shoot and run+shoot, switch weapons (inventory or pickup), idle animations (equipped and not equipped) as well as any melee attacks they may have.

Based on the research I’ve been doing on State Machines within Godot, it doesn’t seem its viable for the scenario I described above, since shooting could be handled in both the standing and running states.

Would anyone else have a different opinion on this? Is there a way to viablely use a SM in a Metal Slug like character controller? If not is there any alternatives that could solve for this?

It is definitely possible to do with a state machine. All you need to is create a RunAndShoot, and StandAndShoot state. They could probably even be combined into one Shoot state.

As long as you know the states ahead. FSM will work.