GMTKGameJam2024/scripts/body.gd

22 lines
572 B
GDScript3
Raw Normal View History

2024-08-16 20:16:19 +01:00
extends Node3D
@export var arms: Array[Node]
2024-08-16 21:24:48 +01:00
signal arm_enabled(arm)
signal arm_disabled(arm)
2024-08-16 20:16:19 +01:00
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
2024-08-16 21:24:48 +01:00
for arm in arms:
2024-08-16 21:34:40 +01:00
arm_enabled.connect(arm._arm_enabled)
arm_disabled.connect(arm._arm_disabled)
2024-08-16 20:16:19 +01:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
2024-08-16 21:24:48 +01:00
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)