added enemy health bar and target with markers
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
assets/Textures/TARGET.jpg
Normal file
BIN
assets/Textures/TARGET.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 48 KiB |
35
assets/Textures/TARGET.jpg.import
Normal file
35
assets/Textures/TARGET.jpg.import
Normal 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
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
22
assets/health_bar_sprite.tscn
Normal file
22
assets/health_bar_sprite.tscn
Normal 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")
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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="."]
|
||||
|
||||
@@ -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
37
assets/target_1.tscn
Normal 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
30
assets/target_marker.tscn
Normal 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")
|
||||
@@ -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
|
||||
|
||||
@@ -62,6 +62,7 @@ item_pickup=""
|
||||
hub_level=""
|
||||
ui=""
|
||||
portal=""
|
||||
range_target=""
|
||||
|
||||
[input]
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=19 format=3 uid="uid://jdwpc622vmok"]
|
||||
[gd_scene load_steps=20 format=3 uid="uid://jdwpc622vmok"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bkii8jwf0k7tq" path="res://scripts/LevelManager.gd" id="1_1bnbi"]
|
||||
[ext_resource type="Resource" uid="uid://bxcxqt7rmfvdw" path="res://GameModes/hubworld.tres" id="2_62iy8"]
|
||||
@@ -18,12 +18,16 @@
|
||||
[ext_resource type="PackedScene" uid="uid://bji3bukudxlhm" path="res://assets/health_dispenser.tscn" id="13_h5xga"]
|
||||
[ext_resource type="PackedScene" uid="uid://c67yfijknmx2m" path="res://assets/revolver2_pickup.tscn" id="16_ipgnf"]
|
||||
[ext_resource type="PackedScene" uid="uid://dyu46bns8mesv" path="res://assets/mac10_pickup.tscn" id="17_u30rd"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1xw80jkg3reb" path="res://assets/target_1.tscn" id="19_sx5wx"]
|
||||
|
||||
[node name="HUB_1" type="Node3D" groups=["hub_level"]]
|
||||
script = ExtResource("1_1bnbi")
|
||||
gamemode = ExtResource("2_62iy8")
|
||||
|
||||
[node name="Realtime Day Night Cycle" parent="." instance=ExtResource("3_qfkdc")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0169516, 0.0284452, -0.00841761)
|
||||
realtime = false
|
||||
set_time = 12.0
|
||||
|
||||
[node name="LEVEL UTILS" type="Node" parent="."]
|
||||
|
||||
@@ -242,3 +246,9 @@ item_price = 100
|
||||
|
||||
[node name="mac10_pickup" parent="." instance=ExtResource("17_u30rd")]
|
||||
transform = Transform3D(-0.254518, -0.967068, 0, 0.967068, -0.254518, 0, 0, 0, 1, -7.54046, 1.3363, 3.95008)
|
||||
|
||||
[node name="TARGET 1" parent="." instance=ExtResource("19_sx5wx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -11.4249, 3.22414, 9.56468)
|
||||
|
||||
[node name="TARGET 2" parent="." instance=ExtResource("19_sx5wx")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.09968, 3.22414, -6.79385)
|
||||
|
||||
@@ -33,11 +33,11 @@ ssr_enabled = true
|
||||
ssao_enabled = true
|
||||
ssil_enabled = true
|
||||
sdfgi_enabled = true
|
||||
sdfgi_use_occlusion = true
|
||||
glow_enabled = true
|
||||
glow_bloom = 0.2
|
||||
fog_enabled = true
|
||||
fog_density = 0.0005
|
||||
volumetric_fog_enabled = true
|
||||
volumetric_fog_density = 0.0
|
||||
|
||||
[node name="Blockout4" type="Node3D" node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("1_8g3mj")
|
||||
|
||||
@@ -1,7 +1,25 @@
|
||||
extends Control
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
queue_redraw()
|
||||
|
||||
@onready var sub_viewport: SubViewport = $".."
|
||||
@onready var health_bar_sprite: Sprite3D = $"../.."
|
||||
|
||||
var center = Vector2.ZERO
|
||||
var current_health : float
|
||||
|
||||
const MARGIN = 20
|
||||
|
||||
func _ready() -> void:
|
||||
center = Vector2(sub_viewport.size.x/2,sub_viewport.size.y/2)
|
||||
|
||||
func _draw() -> void:
|
||||
draw_circle(Vector2.ZERO,0,Color(1,1,1,1),true,10,true)
|
||||
print("CHARACTER HEALTH : ")
|
||||
var health_percentage : float = health_bar_sprite.character.health/health_bar_sprite.character.start_health
|
||||
#background
|
||||
draw_line(Vector2(0,center.y),Vector2(sub_viewport.size.x,center.y),Color(.5,.5,.5,.75),MARGIN * 2,true)
|
||||
|
||||
#health
|
||||
for i in range(health_bar_sprite.character.health):
|
||||
var width = sub_viewport.size.x / health_bar_sprite.character.start_health
|
||||
var from = width * i + MARGIN/2
|
||||
var to = width * (i+1) - MARGIN/2
|
||||
draw_line(Vector2(from,center.y),Vector2(to,center.y),ColorSwatch.RED_COLOR,30,true)
|
||||
|
||||
@@ -14,7 +14,7 @@ func _ready():
|
||||
|
||||
scale.x = 1 * rand_scale
|
||||
scale.y = 1 * rand_scale
|
||||
text = str(damage_amt)
|
||||
text = str(int(damage_amt))
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
||||
@@ -45,6 +45,10 @@ func _physics_process(delta):
|
||||
instance_bullethole.look_at(ray.get_collision_point() + ray.get_collision_normal())
|
||||
instance_bullethole.rotation.z = deg_to_rad(randf_range(0,360))
|
||||
|
||||
#range target
|
||||
if body.is_in_group("range_target"):
|
||||
body.add_marker(ray.get_collision_point(),ray.global_rotation)
|
||||
|
||||
# Leaking effect
|
||||
if body.is_in_group("leak"):
|
||||
var leakspawn = water_leak.instantiate()
|
||||
|
||||
7
scripts/health_bar_sprite.gd
Normal file
7
scripts/health_bar_sprite.gd
Normal file
@@ -0,0 +1,7 @@
|
||||
extends Sprite3D
|
||||
|
||||
@export var character : Node
|
||||
@onready var health_bar: Control = $SubViewport/HealthBar
|
||||
|
||||
func health_update():
|
||||
health_bar.queue_redraw()
|
||||
1
scripts/health_bar_sprite.gd.uid
Normal file
1
scripts/health_bar_sprite.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cjlwdeu1cft4i
|
||||
@@ -33,7 +33,7 @@ func _on_continue_pressed() -> void:
|
||||
|
||||
|
||||
if GameGlobals.current_level == null:
|
||||
level = "res://scenes/HUBWORLD.tscn"
|
||||
level = "res://scenes/blockout_4.tscn"
|
||||
load_to_gamemode = "res://GameModes/hubworld.tres"
|
||||
else:
|
||||
level = GameGlobals.current_level
|
||||
|
||||
@@ -37,6 +37,8 @@ func _on_body_entered(body: Node3D) -> void:
|
||||
SaveLoad.save_game_data(get_tree().current_scene.get_name())
|
||||
SaveLoad.save_user_data()
|
||||
get_tree().change_scene_to_file(scene_path)
|
||||
else:
|
||||
body.velocity = -body.velocity * 2
|
||||
|
||||
|
||||
func _on_start_activation_timeout() -> void:
|
||||
|
||||
@@ -10,6 +10,7 @@ signal money_deposited()
|
||||
signal player_exiting_tree()
|
||||
signal player_hit()
|
||||
signal shot_fired()
|
||||
signal player_reloading()
|
||||
signal enemy_hit()
|
||||
signal enemy_killed()
|
||||
signal king_killed()
|
||||
|
||||
@@ -5,7 +5,7 @@ signal last_enemy_dead()
|
||||
var player
|
||||
var last_enemy : bool = false
|
||||
|
||||
@export var health = 3
|
||||
@export var start_health = 3
|
||||
@export var SPEED = 3.0
|
||||
@export var loot_amount = 2
|
||||
const MAX_LV = 10
|
||||
@@ -58,6 +58,8 @@ $body/leg3/leg3outline,
|
||||
$body/leg4/foot4/foot4outline,
|
||||
$body/leg4/leg4outline,
|
||||
$body/bodyoutline]
|
||||
@onready var health_bar_sprite: Sprite3D = $HealthBarSprite
|
||||
|
||||
|
||||
var gravity = 9.8
|
||||
var particlespawn
|
||||
@@ -73,11 +75,13 @@ var player_in_view = false
|
||||
var player_last_seen
|
||||
var knocked = false
|
||||
var stunned = false
|
||||
var health
|
||||
|
||||
func _ready():
|
||||
health = start_health
|
||||
player = level_control.player
|
||||
#health_bar_sprite.visible = false
|
||||
turret_material.emission_enabled = false
|
||||
|
||||
#randomly start the postfire timer so enemy turrets aren't synced
|
||||
var random_time = randf_range(0,5)
|
||||
await get_tree().create_timer(random_time).timeout
|
||||
@@ -124,6 +128,8 @@ func _process(delta):
|
||||
|
||||
|
||||
func _on_area_3d_body_part_hit(dam,bullet_damage):
|
||||
health_bar_sprite.visible = true
|
||||
health_bar_sprite.health_update()
|
||||
if !dying:
|
||||
health -= dam * bullet_damage
|
||||
if health <= 0:
|
||||
@@ -243,6 +249,7 @@ func save():
|
||||
"rot_x" : rotation.x,
|
||||
"rot_y" : rotation.y,
|
||||
"rot_z" : rotation.z,
|
||||
"start_health" : start_health,
|
||||
"health" : health
|
||||
}
|
||||
return save_dict
|
||||
|
||||
21
scripts/target_1.gd
Normal file
21
scripts/target_1.gd
Normal file
@@ -0,0 +1,21 @@
|
||||
extends StaticBody3D
|
||||
|
||||
@onready var ray_cast_3d: RayCast3D = $RayCast3D
|
||||
|
||||
const TARGET_MARKER = preload("res://assets/target_marker.tscn")
|
||||
|
||||
func _ready() -> void:
|
||||
SignalBus.player_reloading.connect(remove_targets)
|
||||
|
||||
func remove_targets():
|
||||
print("PLAYER RELOADING")
|
||||
for i in get_children():
|
||||
if i.is_in_group("target_marker"):
|
||||
i.queue_free()
|
||||
|
||||
func add_marker(collision_point,bullet_rotation):
|
||||
var instance_marker = TARGET_MARKER.instantiate()
|
||||
add_child(instance_marker)
|
||||
instance_marker.global_position = collision_point
|
||||
instance_marker.global_rotation = bullet_rotation
|
||||
|
||||
1
scripts/target_1.gd.uid
Normal file
1
scripts/target_1.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xua2jmq16kjc
|
||||
@@ -134,6 +134,7 @@ func shoot():
|
||||
anim_player.play("shoot")
|
||||
|
||||
func reload():
|
||||
SignalBus.emit_signal("player_reloading")
|
||||
match weapon_info.weapon_type:
|
||||
0:
|
||||
match weapon_info.reload_type:
|
||||
|
||||
Reference in New Issue
Block a user