Browse Source

Merge pull request #435 from Calinou/fix-hfsm-comment

Fix incorrect comment in hierarchical FSM demo script
Aaron Franke 5 years ago
parent
commit
db2941bed4
1 changed files with 6 additions and 7 deletions
  1. 6 7
      2d/finite_state_machine/state_machine/state_machine.gd

+ 6 - 7
2d/finite_state_machine/state_machine/state_machine.gd

@@ -7,10 +7,9 @@ extends Node
 
 
 signal state_changed(current_state)
 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
 export(NodePath) var start_state
 var states_map = {}
 var states_map = {}
 
 
@@ -60,14 +59,14 @@ func _change_state(state_name):
 	if not _active:
 	if not _active:
 		return
 		return
 	current_state.exit()
 	current_state.exit()
-	
+
 	if state_name == "previous":
 	if state_name == "previous":
 		states_stack.pop_front()
 		states_stack.pop_front()
 	else:
 	else:
 		states_stack[0] = states_map[state_name]
 		states_stack[0] = states_map[state_name]
-	
+
 	current_state = states_stack[0]
 	current_state = states_stack[0]
 	emit_signal("state_changed", current_state)
 	emit_signal("state_changed", current_state)
-	
+
 	if state_name != "previous":
 	if state_name != "previous":
 		current_state.enter()
 		current_state.enter()