Fix incorrect comment in hierarchical FSM demo script

This closes #433.
This commit is contained in:
Hugo Locurcio
2020-03-09 15:00:56 +01:00
parent 9809601e40
commit 222f94444a

View File

@@ -7,10 +7,9 @@ extends Node
signal state_changed(current_state)
# You must set a starting node from the inspector or on
# the node that inherits from this state machine interface.
# If you don't the game will crash (on purpose, so you won't
# forget to initialize the state machine).
# You should set a starting node from the inspector or on the node that inherits
# from this state machine interface. If you don't, the game will default to
# the first state in the state machine's children.
export(NodePath) var start_state
var states_map = {}
@@ -60,14 +59,14 @@ func _change_state(state_name):
if not _active:
return
current_state.exit()
if state_name == "previous":
states_stack.pop_front()
else:
states_stack[0] = states_map[state_name]
current_state = states_stack[0]
emit_signal("state_changed", current_state)
if state_name != "previous":
current_state.enter()