adds basic arm control flow system

This commit is contained in:
Rosia E Evans 2024-08-16 21:24:48 +01:00
parent 476d817a63
commit 60988cf783
4 changed files with 27 additions and 8 deletions

View file

@ -1,6 +1,6 @@
extends Node3D
@export var key: Key
@export var action: StringName
# Called when the node enters the scene tree for the first time.
@ -11,3 +11,12 @@ func _ready() -> void:
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _arm_enabled(arm):
print_debug("enabled!")
pass
func _arm_disabled(arm):
print_debug("disabled!")
pass

View file

@ -2,12 +2,20 @@ extends Node3D
@export var arms: Array[Node]
signal arm_enabled(arm)
signal arm_disabled(arm)
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
for arm in arms:
arm_enabled.connect(arm.arm_enabled)
arm_disabled.connect(arm.arm_disabled)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _physics_process(delta: float) -> void:
for arm in arms:
if Input.is_action_just_pressed(arm.action):
arm_enabled.emit(arm)
if Input.is_action_just_released(arm.action):
arm_disabled.emit(arm)