![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | SilentCipher |
In the _ready() method, I’m calling method on that is declared in the same script, _change_state(IDLE). The error is saying that my IDLE keyword in the call is out of scope, any ideas?
enum STATES { IDLE, MOVE }
var state = null
func _ready():
_change_state(IDLE)
func _change_state(new_state):
emit_signal('state_changed', new_state)
# Initialize the new state
match new_state:
IDLE:
$AnimationPlayer.play("idle")
MOVE:
$AnimationPlayer.play("walk")
state = new_state
which identifier? is the signal “state_changed” declared in this script or another?
ener | 2021-10-08 07:46
Hello ener,
Thanks for your reply.
Yes! that method _change_state() is declared on the same script file.
Also my apologies, I’ll adjust the question.
The error is that in the line where _change_sate(IDLE) is being called. it is saying IDLE is out of scope. I’ll edit the question.
SilentCipher | 2021-10-08 16:13