Trap explosions with damage and health bar depletion.

This commit is contained in:
2025-12-29 15:03:05 -05:00
parent e632e54cba
commit 84bf495d11
16 changed files with 149 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=30 format=3 uid="uid://bgocskbofewsr"]
[gd_scene load_steps=31 format=3 uid="uid://bgocskbofewsr"]
[ext_resource type="Script" uid="uid://bm50jiya4s3ei" path="res://scripts/hud.gd" id="1_jiiqi"]
[ext_resource type="Texture2D" uid="uid://dri0a20l6kpbj" path="res://visuals/images/icon.svg" id="1_k5de2"]
@@ -11,6 +11,7 @@
[ext_resource type="Texture2D" uid="uid://btjn353r1qg1q" path="res://visuals/images/icons/player 2 tag.png" id="3_k0acs"]
[ext_resource type="Texture2D" uid="uid://urh11huy67cs" path="res://visuals/materials/health gradient.tres" id="3_vhta5"]
[ext_resource type="PackedScene" uid="uid://xk323c0ta2b" path="res://templates/trap_icon.tscn" id="4_aopqe"]
[ext_resource type="Script" uid="uid://bolw6n14ocxt3" path="res://scripts/healthbar.gd" id="4_iv5le"]
[ext_resource type="Texture2D" uid="uid://bcv3f38cib5xk" path="res://visuals/images/icons/mine.png" id="4_l86lr"]
[ext_resource type="Texture2D" uid="uid://cyuylbs0o72xk" path="res://visuals/images/icons/pitfall.png" id="5_aopqe"]
[ext_resource type="Texture2D" uid="uid://hiwrcar5fnyk" path="res://visuals/images/icons/switch.png" id="6_e7ody"]
@@ -79,12 +80,14 @@ theme_override_constants/separation = 2
layout_mode = 2
texture = ExtResource("2_yda1o")
[node name="ProgressBar" type="TextureProgressBar" parent="Control/PanelContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer"]
[node name="P1HealthBar" type="TextureProgressBar" parent="Control/PanelContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer"]
unique_name_in_owner = true
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
value = 100.0
nine_patch_stretch = true
texture_over = ExtResource("3_vhta5")
texture_progress = ExtResource("3_vhta5")
script = ExtResource("4_iv5le")
[node name="PanelContainer2" type="PanelContainer" parent="Control/PanelContainer/HBoxContainer/VBoxContainer2"]
custom_minimum_size = Vector2(250, 100)
@@ -98,12 +101,12 @@ theme_override_constants/separation = 2
layout_mode = 2
texture = ExtResource("3_k0acs")
[node name="ProgressBar" type="TextureProgressBar" parent="Control/PanelContainer/HBoxContainer/VBoxContainer2/PanelContainer2/VBoxContainer"]
[node name="P2HealthBar" type="TextureProgressBar" parent="Control/PanelContainer/HBoxContainer/VBoxContainer2/PanelContainer2/VBoxContainer"]
custom_minimum_size = Vector2(0, 50)
layout_mode = 2
value = 100.0
nine_patch_stretch = true
texture_over = ExtResource("3_vhta5")
texture_progress = ExtResource("3_vhta5")
[node name="VBoxContainer" type="VBoxContainer" parent="Control/PanelContainer/HBoxContainer"]
custom_minimum_size = Vector2(150, 0)

View File

@@ -157,7 +157,6 @@ size = Vector2(0.25, 1)
center_offset = Vector3(0, 0.4, 0)
[sub_resource type="Animation" id="Animation_d5gho"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@@ -168,7 +167,7 @@ tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
@@ -177,10 +176,10 @@ tracks/1/path = NodePath("StreakFX:emitting")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"times": PackedFloat32Array(0, 0.033333335),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false]
"values": [false, true]
}
tracks/2/type = "value"
tracks/2/imported = false
@@ -189,10 +188,10 @@ tracks/2/path = NodePath("OmniLight3D:light_energy")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"times": PackedFloat32Array(0, 0.06666667),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [20.0]
"values": [20.0, 0.0]
}
[sub_resource type="Animation" id="Animation_gf6ds"]
@@ -234,6 +233,20 @@ tracks/2/keys = {
"update": 0,
"values": [20.0, 0.0]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [3.0],
"method": &"proximal_shake"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_p88g7"]
_data = {
@@ -258,7 +271,6 @@ draw_pass_1 = SubResource("SphereMesh_4y8np")
[node name="ParticleFX" type="GPUParticles3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.4375714, 0, 0.5602956)
material_override = ExtResource("2_l2v4y")
emitting = false
amount = 10
lifetime = 0.6
one_shot = true

View File

@@ -16,6 +16,8 @@ height = 1.0
[node name="Player" type="CharacterBody3D"]
physics_interpolation_mode = 1
collision_layer = 2
collision_mask = 5
floor_constant_speed = true
floor_max_angle = 0.93549645
floor_snap_length = 1.0

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=7 format=3 uid="uid://bk3yqawritfnj"]
[gd_scene load_steps=8 format=3 uid="uid://bk3yqawritfnj"]
[ext_resource type="Script" uid="uid://yjsgte3x7jjw" path="res://scripts/trap.gd" id="1_6h4aj"]
[ext_resource type="ArrayMesh" uid="uid://bih57xe642hrc" path="res://models/trap.obj" id="2_oj6ox"]
@@ -14,7 +14,12 @@ albedo_color = Color(1, 1, 0, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_dw7u0"]
size = Vector3(0.8, 1, 0.8)
[sub_resource type="BoxShape3D" id="BoxShape3D_6h4aj"]
resource_local_to_scene = true
[node name="Trap" type="Area3D"]
collision_layer = 4
collision_mask = 2
script = ExtResource("1_6h4aj")
[node name="Model" type="MeshInstance3D" parent="."]
@@ -40,4 +45,14 @@ texture = ExtResource("3_mxvh5")
[node name="RevealTimer" type="Timer" parent="."]
unique_name_in_owner = true
[node name="RangeArea" type="Area3D" parent="."]
unique_name_in_owner = true
collision_layer = 0
collision_mask = 2
[node name="RangeShape" type="CollisionShape3D" parent="RangeArea"]
unique_name_in_owner = true
shape = SubResource("BoxShape3D_6h4aj")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="timeout" from="RevealTimer" to="." method="_on_reveal_timeout"]