About state machines

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

Hello, I was wondering here how to create a state machine for a turn based rpg.
First I thought to create 2 Enums:

enum states {IDLE, WALK, JUMP, FALL}
enum battle {IDLE, LOW_LIFE, ATTACKING, MAGIC, ITEM, ESCAPE}

But I never made any game like that on godot. Someone can illuminate me and guide me is this is the right way?

:bust_in_silhouette: Reply From: Moldor2

GDscript has a great tutorial for this, or if you are looking for a simpler method just declare one enum with all the states and then create a function called through process that gets input and assign your state based on input, at least that’s how I would do it.