mirror of
https://github.com/godotengine/godot-demo-projects.git
synced 2026-01-04 06:09:46 +03:00
Now there's a base state_machine script, the StateMachine is separate from the physics body. I reworked the code to follow the GDscript guidelines in the official manual.
20 lines
374 B
GDScript
20 lines
374 B
GDScript
tool
|
|
extends Panel
|
|
|
|
onready var fsm_node = get_node("../Player/StateMachine")
|
|
|
|
func _ready():
|
|
set_as_toplevel(true)
|
|
|
|
func _process(delta):
|
|
var states_names = ''
|
|
var numbers = ''
|
|
var index = 0
|
|
for state in fsm_node.states_stack:
|
|
states_names += state.get_name() + '\n'
|
|
numbers += str(index) + '\n'
|
|
index += 1
|
|
|
|
$States.text = states_names
|
|
$Numbers.text = numbers
|