0 votes

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?

in Engine by (177 points)

1 Answer

0 votes

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.

by (96 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.