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 @@
[gd_scene load_steps=3 format=3 uid="uid://dgm3241ceqpim"]
[ext_resource type="Script" path="res://body.gd" id="1_21au4"]
[ext_resource type="Script" path="res://scripts/body.gd" id="1_21au4"]
[sub_resource type="SphereMesh" id="SphereMesh_jcpb6"]
radius = 5.0

View file

@ -1,11 +1,13 @@
[gd_scene load_steps=2 format=3 uid="uid://cgqpfh5j5v3yd"]
[gd_scene load_steps=3 format=3 uid="uid://c4aghhlbletw"]
[ext_resource type="PackedScene" uid="uid://ccggyhqyue6fr" path="res://assets/pickaxe_arm.glb" id="1_grvsx"]
[ext_resource type="Script" path="res://scripts/arm.gd" id="2_u82st"]
[node name="pickaxe_arm" instance=ExtResource("1_grvsx")]
script = ExtResource("2_u82st")
[node name="Sphere_004" parent="Armature/Skeleton3D" index="0"]
transform = Transform3D(0.919691, 0, -2.19271e-07, 0, 0.919691, 0, 2.19271e-07, 0, 0.919691, 0, -9.53674e-07, 0)
transform = Transform3D(0.919691, 0, 0, 0, 0.919691, 0, 0, 0, 0.919691, 0, -9.53674e-07, 0)
[node name="Sphere_001" parent="Armature/Skeleton3D" index="1"]
transform = Transform3D(0.919691, 0, 0, 0, 0.919691, 0, 0, 0, 0.919691, 0, 0, 0)

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)