godot-plateformer/_game/DemoScript.gd

22 lines
529 B
GDScript

extends Node2D
@onready var act_manager: ActManager = $ReedScene/ActManager
var s := 1
func _unhandled_input(event: InputEvent) -> void:
if act_manager == null:
return
if event.is_action_pressed("ui_right"):
s = clampi(s+1,0,2)
act_manager.switch_act_with_id(s)
elif event.is_action_pressed("ui_left"):
s = clampi(s-1,0,2)
act_manager.switch_act_with_id(s)
elif event.is_action_pressed("ui_up"):
act_manager.switch_act_with_id(3)
elif event.is_action_pressed("ui_down"):
act_manager.switch_act_with_id(4)