Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var current_state: State
- var previous_state: State
- func _ready():
- current_state = get_child(0) as State
- previous_state = current_state
- current_state.enter()
- func change_state(state):
- if state == previous_state.name:
- return
- current_state = find_child(state) as State
- current_state.enter()
- previous_state.exit()
- previous_state = current_state
Advertisement
Add Comment
Please, Sign In to add comment