added enemy health bar and target with markers

This commit is contained in:
derek
2025-03-22 19:09:13 -05:00
parent b85014c48b
commit c435db8b67
30 changed files with 239 additions and 33 deletions

BIN
assets/Textures/TARGET.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

View File

@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dlyqngebvo4h3"
path.s3tc="res://.godot/imported/TARGET.jpg-9ce2904937e828b82caf30d057a34e35.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/Textures/TARGET.jpg"
dest_files=["res://.godot/imported/TARGET.jpg-9ce2904937e828b82caf30d057a34e35.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View File

@@ -8,6 +8,7 @@ var rng = RandomNumberGenerator.new()
var random_rotation = true
var particle_number
var player_velocity
var despawning = false
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -32,11 +33,15 @@ func _process(delta):
if level_control != null: #replace this check when level reload works properly
if level_control.particle_number >= (particle_number + level_control.MAX_PARTICLES):
_on_timer_timeout()
if despawning:
linear_velocity.y -= .1 * delta
func _on_timer_timeout():
collision_shape.disabled = true
gravity_scale = .1
await get_tree().create_timer(1).timeout
gravity_scale = 0
despawning = true
await get_tree().create_timer(2).timeout
queue_free()

View File

@@ -0,0 +1,22 @@
[gd_scene load_steps=4 format=3 uid="uid://dsmm13xy7ofxj"]
[ext_resource type="Script" uid="uid://dfc80ru6aro15" path="res://scripts/3D Health Bar.gd" id="1_1iqq6"]
[ext_resource type="Script" uid="uid://cjlwdeu1cft4i" path="res://scripts/health_bar_sprite.gd" id="1_uc5m4"]
[sub_resource type="ViewportTexture" id="ViewportTexture_87l3v"]
viewport_path = NodePath("SubViewport")
[node name="HealthBarSprite" type="Sprite3D"]
texture = SubResource("ViewportTexture_87l3v")
script = ExtResource("1_uc5m4")
[node name="SubViewport" type="SubViewport" parent="."]
transparent_bg = true
size = Vector2i(512, 100)
[node name="HealthBar" type="Control" parent="SubViewport"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("1_1iqq6")

View File

@@ -31,8 +31,8 @@ radius = 0.509802
height = 2.03547
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_rw673"]
radius = 0.509802
height = 1.19106
radius = 0.2
height = 0.4
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_vhypf"]
dof_blur_amount = 0.3
@@ -155,6 +155,10 @@ shape = SubResource("CapsuleShape3D_rw673")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.589976, 0)
target_position = Vector3(0, 0.9, 0)
[node name="EternalCollision" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.421329, 0)
shape = SubResource("CapsuleShape3D_rw673")
[node name="Head" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.889, 0)

View File

@@ -434,7 +434,7 @@ mesh = SubResource("ArrayMesh_exipw")
skeleton = NodePath("")
[node name="leg1" type="MeshInstance3D" parent="body"]
transform = Transform3D(0.545256, 0.554857, 0.628353, -0.71325, 0.700909, 0, -0.440419, -0.448174, 0.777926, -0.305074, -0.206463, 0.323723)
transform = Transform3D(0.691128, 0.703297, 0.166475, -0.71325, 0.700909, 0, -0.116684, -0.118739, 0.986044, -0.305074, -0.206463, 0.323723)
mesh = SubResource("ArrayMesh_cwwo8")
skeleton = NodePath("")
@@ -444,7 +444,7 @@ mesh = SubResource("ArrayMesh_epfun")
skeleton = NodePath("")
[node name="leg2" type="MeshInstance3D" parent="body"]
transform = Transform3D(-0.700522, -0.712808, 0.0342363, -0.713225, 0.700934, 1.61711e-09, -0.0239974, -0.0244182, -0.999414, 0.318604, -0.206463, 0.321527)
transform = Transform3D(-0.602295, -0.612652, 0.511759, -0.713107, 0.701054, 9.43361e-09, -0.35877, -0.364939, -0.859129, 0.318604, -0.206463, 0.321527)
mesh = SubResource("ArrayMesh_j8pcb")
skeleton = NodePath("")
@@ -454,7 +454,7 @@ mesh = SubResource("ArrayMesh_vgp1v")
skeleton = NodePath("")
[node name="leg3" type="MeshInstance3D" parent="body"]
transform = Transform3D(0.545256, 0.554857, -0.628353, -0.71325, 0.700909, 0, 0.440419, 0.448174, 0.777926, -0.327034, -0.206463, -0.315327)
transform = Transform3D(0.691128, 0.703297, -0.166475, -0.71325, 0.700909, 0, 0.116684, 0.118739, 0.986044, -0.327034, -0.206463, -0.315327)
mesh = SubResource("ArrayMesh_wv2l2")
skeleton = NodePath("")
@@ -464,7 +464,7 @@ mesh = SubResource("ArrayMesh_375ql")
skeleton = NodePath("")
[node name="leg4" type="MeshInstance3D" parent="body"]
transform = Transform3D(-0.698191, -0.710435, -0.0883846, -0.713227, 0.700934, -2.37315e-08, 0.0619519, 0.0630383, -0.996086, 0.351545, -0.206463, -0.339484)
transform = Transform3D(-0.578345, -0.588289, -0.565184, -0.713109, 0.701054, -1.3844e-07, 0.396225, 0.403037, -0.824964, 0.351545, -0.206463, -0.339484)
mesh = SubResource("ArrayMesh_v81tc")
skeleton = NodePath("")
@@ -488,7 +488,7 @@ shape = SubResource("BoxShape3D_n5tdt")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_vojnr")
&"": SubResource("AnimationLibrary_vojnr")
}
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]

View File

@@ -1,11 +1,11 @@
[gd_scene load_steps=97 format=4 uid="uid://djr7vnr1hcx82"]
[gd_scene load_steps=98 format=4 uid="uid://djr7vnr1hcx82"]
[ext_resource type="Script" uid="uid://cdofgtwevbray" path="res://scripts/spider.gd" id="1_7e7fe"]
[ext_resource type="PackedScene" uid="uid://h5ojldugfyyu" path="res://assets/bullet_enemy.tscn" id="2_aew5r"]
[ext_resource type="PackedScene" uid="uid://5jhwtkdggfle" path="res://assets/Enemy_casing.tscn" id="3_e5ft5"]
[ext_resource type="AudioStream" uid="uid://cx016r7bsnadg" path="res://assets/Audio/quartz-crystal-singing-bowl-13-inch-a-rub-rim-suede-mallet-SBA-300114282.wav" id="4_pyp22"]
[ext_resource type="Script" uid="uid://dxkkrhlk2crqm" path="res://scripts/EnemyTarget.gd" id="7_8vkma"]
[ext_resource type="Script" uid="uid://dfc80ru6aro15" path="res://scripts/3D Health Bar.gd" id="7_87l3v"]
[ext_resource type="PackedScene" uid="uid://dsmm13xy7ofxj" path="res://assets/health_bar_sprite.tscn" id="7_87l3v"]
[ext_resource type="Material" uid="uid://bjx8uqmdo7d3j" path="res://assets/spider2.turret.tres" id="7_d5oc0"]
[ext_resource type="PackedScene" uid="uid://b0rkkp07y3fnu" path="res://assets/die_particles.tscn" id="7_w22oa"]
[ext_resource type="Texture2D" uid="uid://ed2omoi280jl" path="res://assets/Models/SubstancePainterTest/spider-LOW_spider1.gunbarrel_BaseColor.png" id="8_87l3v"]
@@ -392,6 +392,9 @@ _bundled = {
"version": 3
}
[sub_resource type="ViewportTexture" id="ViewportTexture_87l3v"]
viewport_path = NodePath("SubViewport")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lxxps"]
resource_name = "spider1.gunbarrel"
cull_mode = 2
@@ -1174,17 +1177,11 @@ die_particles = ExtResource("7_w22oa")
damage_number = ExtResource("9_rmegy")
taunts = Array[String](["did i do that?", "you've been on my shitlist", "you like that?? you want more??", "you should try dodging", "schwing!", "hows your gut now you big cup of dumdum juice?!"])
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.02607, 0)
[node name="SubViewport" type="SubViewport" parent="Sprite3D"]
[node name="Control" type="Control" parent="Sprite3D/SubViewport"]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("7_87l3v")
[node name="HealthBarSprite" parent="." node_paths=PackedStringArray("character") instance=ExtResource("7_87l3v")]
transform = Transform3D(0.254412, 0, 0, 0, 0.561068, 0, 0, 0, 1, 0, 1.95671, 0)
billboard = 2
texture = SubResource("ViewportTexture_87l3v")
character = NodePath("..")
[node name="TurretLook" type="RayCast3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00161432, 1.62046, 0.00134204)

37
assets/target_1.tscn Normal file
View File

@@ -0,0 +1,37 @@
[gd_scene load_steps=7 format=3 uid="uid://c1xw80jkg3reb"]
[ext_resource type="Texture2D" uid="uid://dlyqngebvo4h3" path="res://assets/Textures/TARGET.jpg" id="1_bbjaa"]
[ext_resource type="Script" uid="uid://xua2jmq16kjc" path="res://scripts/target_1.gd" id="1_ishjx"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ishjx"]
albedo_texture = ExtResource("1_bbjaa")
uv1_scale = Vector3(3.07, 2.05, 3.07)
[sub_resource type="BoxMesh" id="BoxMesh_polhc"]
material = SubResource("StandardMaterial3D_ishjx")
[sub_resource type="BoxShape3D" id="BoxShape3D_6f6oa"]
[sub_resource type="BoxShape3D" id="BoxShape3D_polhc"]
[node name="TARGET 1" type="StaticBody3D" groups=["range_target"]]
script = ExtResource("1_ishjx")
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
mesh = SubResource("BoxMesh_polhc")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_6f6oa")
[node name="Area3D" type="Area3D" parent="."]
collision_layer = 128
collision_mask = 128
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D"]
shape = SubResource("BoxShape3D_polhc")
[node name="RayCast3D" type="RayCast3D" parent="."]
target_position = Vector3(0, 0, -1)
collision_mask = 128
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]

30
assets/target_marker.tscn Normal file
View File

@@ -0,0 +1,30 @@
[gd_scene load_steps=4 format=3 uid="uid://bwimv1ed6o85e"]
[sub_resource type="SphereMesh" id="SphereMesh_ejmtl"]
radius = 0.05
height = 0.1
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fmyhe"]
shading_mode = 0
albedo_color = Color(0, 1, 0, 0.870588)
[sub_resource type="CylinderMesh" id="CylinderMesh_0f8ut"]
top_radius = 0.1
bottom_radius = 0.01
[node name="ShootMarker" type="Node3D" groups=["target_marker"]]
[node name="Sphere" type="MeshInstance3D" parent="."]
transform = Transform3D(0.395, 0, 0, 0, -1.7266e-08, -0.395, 0, 0.395, -1.7266e-08, 0, 0, 0)
mesh = SubResource("SphereMesh_ejmtl")
skeleton = NodePath("../MeshHandle")
surface_material_override/0 = SubResource("StandardMaterial3D_fmyhe")
[node name="MeshHandle" type="Node3D" parent="."]
transform = Transform3D(0.395, 0, 0, 0, -1.7266e-08, -0.395, 0, 0.395, -1.7266e-08, 0, 0, 0)
[node name="Mesh" type="MeshInstance3D" parent="MeshHandle"]
transform = Transform3D(1.673, 0, 0, 0, 1.30515, 2.84217e-14, 0, -1.77636e-14, 1.673, 0, 1.30732, -1.34336e-08)
mesh = SubResource("CylinderMesh_0f8ut")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("StandardMaterial3D_fmyhe")

View File

@@ -26,8 +26,10 @@ reload_type = 1
bullet = SubResource("Resource_vli3e")
fire_mode = 1
fov_zoom_amt = 0.98
crosshair_radius = 50
ads = false
recoil_amount = Vector3(0.2, 0.05, 0.05)
crosshair_jump_amount = 10
kick_amount = 0.1
max_ammo = 6
start_mags = 1