[gd_scene load_steps=7 format=2] [ext_resource path="res://src/Main/StateMachine/StateMachine.gd" type="Script" id=1] [ext_resource path="res://assets/fonts/Montserrat-Bold.ttf" type="DynamicFontData" id=3] [sub_resource type="DynamicFont" id=1] size = 32 font_data = ExtResource( 3 ) [sub_resource type="GDScript" id=2] script/source = "extends Label onready var state_machine: StateMachine = $\"../StateMachine\" func _on_StateMachine_transitioned(state_path) -> void: text = \"Active state: %s\" % [state_machine._state_name] " [sub_resource type="GDScript" id=3] script/source = "extends State func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed(\"ui_cancel\"): _state_machine.transition_to(\"Run\") get_tree().set_input_as_handled() " [sub_resource type="GDScript" id=4] script/source = "extends State func _unhandled_input(event: InputEvent) -> void: if event.is_action_pressed(\"ui_accept\"): _state_machine.transition_to(\"Idle\") get_tree().set_input_as_handled() " [node name="Game" type="Node"] [node name="Label" type="Label" parent="."] anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 margin_left = -300.0 margin_top = -103.0 margin_right = 300.0 margin_bottom = 103.0 custom_fonts/font = SubResource( 1 ) text = "Text" align = 1 script = SubResource( 2 ) __meta__ = { "_edit_use_anchors_": false } [node name="StateMachine" type="Node" parent="."] script = ExtResource( 1 ) initial_state = NodePath("Idle") [node name="Idle" type="Node" parent="StateMachine"] script = SubResource( 3 ) [node name="Run" type="Node" parent="StateMachine"] script = SubResource( 4 ) [connection signal="transitioned" from="StateMachine" to="Label" method="_on_StateMachine_transitioned"]