All Questions

Community

S
Brody Schulke
posted to: Coding the State

Why not use Get_Node to assign the StateMachine to the various States?

Just curious why the recursive approach was used here - couldn't we do something like:

onready var _state_machine: = get_node("../../StateMachine")

while adjusting the relative path for the "State" node?

  • Nathan Lovato replied

    You'd have to manually get it right on every state, while the recursive function gets it right no matter how many states you have or how you rearrange them.