Hello everyone, I hope you're well.
I'm having trouble either implementing or utilizing my game state machine.
Context - My game is a top down 2D roguelike. There are two main states that the game can be in, either the "Explore" phase, where players have free movement around the dungeon to explore and loot items. Or, there is the "Combat" phase, where players engage in combat with the enemies in the dungeon. Players no longer have the ability to move freely, and the game changes into a turn based RPG, where players can either select to move to another tile, or use a spell or attack.
Right now I am using a script that is autoloaded and has the global variable setting turned on. I have a state machine on this script, and the current state is saved in a variable. I am trying to have the player read the current state of the state machine and either turn off or on the player's ability to move. I have tried to do it via game_state_machine.state,
but the current while game_state_machine.state == "EXPLORE"
results in an error (EXPLORE not declared in current context). It doesn't seem right to me that I must redefine each state in each script that relies on the current game state.
If anyone knows what I am doing wrong and how to properly implement this, I would greatly appreciate any support or guidance.


Thank you and have a nice day.