improved cronies

This commit is contained in:
Haze Weathers 2025-02-23 12:19:18 -05:00
parent dd17c93d48
commit adc5281f77
3 changed files with 12 additions and 13 deletions

View file

@ -5,6 +5,8 @@ extends CharacterBody3D
@export_range(0,1,1,"or_less","or_greater","radians_as_degrees")
var rotation_speed: float
@export var death_delay: float
@export var sound_pitch_min: float
@export var sound_pitch_max: float
@export_group("Node References")
@export var model: Node3D
@ -29,7 +31,6 @@ func _physics_process(delta: float) -> void:
func _on_player_detector_body_entered(body: Node3D) -> void:
if body is Player:
model.visible = false
death_sound.pitch_scale = randf_range(sound_pitch_min, sound_pitch_max)
death_sound.play()
var tween = create_tween()
tween.set_process_mode(Tween.TWEEN_PROCESS_PHYSICS)
tween.tween_callback(queue_free).set_delay(death_delay)
get_tree().create_timer(death_delay, false, true).timeout.connect(queue_free)

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://b4a8aif3iigdw"]
[gd_scene load_steps=6 format=3 uid="uid://b4a8aif3iigdw"]
[ext_resource type="Script" path="res://objects/boney.gd" id="1_bofrm"]
[ext_resource type="PackedScene" uid="uid://46kyrtlb6b0a" path="res://assets/models/enemies/boney.glb" id="2_ssgky"]
@ -10,20 +10,20 @@ radius = 0.4
[sub_resource type="CylinderShape3D" id="CylinderShape3D_cdksx"]
height = 0.5
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_5d27a"]
random_pitch = 1.5
streams_count = 1
stream_0/stream = ExtResource("3_a4a2f")
radius = 0.475
[node name="Boney" type="CharacterBody3D" node_paths=PackedStringArray("model", "death_sound")]
script = ExtResource("1_bofrm")
speed = 2.0
rotation_speed = 3.14159
death_delay = 0.2
sound_pitch_min = 0.8
sound_pitch_max = 1.5
model = NodePath("Model")
death_sound = NodePath("DeathSound")
[node name="Model" parent="." instance=ExtResource("2_ssgky")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0)
transform = Transform3D(0.368124, 0, 0.929775, 0, 1, 0, -0.929775, 0, 0.368124, 0, 0.75, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
@ -39,7 +39,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
shape = SubResource("CylinderShape3D_cdksx")
[node name="DeathSound" type="AudioStreamPlayer3D" parent="."]
stream = SubResource("AudioStreamRandomizer_5d27a")
stream = ExtResource("3_a4a2f")
bus = &"Sounds"
[connection signal="body_entered" from="PlayerDetector" to="." method="_on_player_detector_body_entered" flags=6]

View file

@ -72,5 +72,3 @@ polygon = PackedVector2Array(0, -1, 1, -1, 3, 0, 3, 2, 2, 3, -1, 2, -2, 0)
[node name="Boney" parent="." instance=ExtResource("6_gpbt0")]
transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, 1.98854, 0, 1.02292)
speed = 1.0
rotation_speed = 3.14159