tweaks to hud and finally have the machete... kind of working?

This commit is contained in:
Derek
2025-02-25 20:46:24 -06:00
parent 38a93588a2
commit c5321d1fab
6 changed files with 12 additions and 19 deletions

View File

@@ -281,11 +281,10 @@ cast_shadow = 0
mesh = SubResource("ArrayMesh_io6u4")
skeleton = NodePath("")
[node name="Area3D" type="Area3D" parent="MacheteHandle"]
[node name="Area3D" type="RigidBody3D" parent="MacheteHandle"]
transform = Transform3D(-4.37114e-08, -1, 4.37114e-08, 0.314307, -5.5235e-08, -0.949321, 0.949321, -2.77573e-08, 0.314307, 0, 0.415, -0.0427188)
collision_layer = 128
collision_mask = 232
priority = 1
script = ExtResource("12_u0mbp")
[node name="CollisionShape3D" type="CollisionShape3D" parent="MacheteHandle/Area3D"]
@@ -305,5 +304,3 @@ libraries = {
[node name="Audio" type="Node3D" parent="."]
[node name="Swing" type="AudioStreamPlayer3D" parent="Audio"]
[connection signal="body_entered" from="MacheteHandle/Area3D" to="." method="_on_area_3d_body_entered"]

View File

@@ -165,26 +165,26 @@ theme_override_constants/outline_size = 15
text = "Gun Name"
horizontal_alignment = 2
[node name="HBoxContainer" type="HBoxContainer" parent="GunInfo/VBoxContainer"]
[node name="AmmoCounter" type="HBoxContainer" parent="GunInfo/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
theme = ExtResource("1_22trs")
theme_override_constants/separation = 50
alignment = 2
[node name="AmmoCurrent" type="Label" parent="GunInfo/VBoxContainer/HBoxContainer"]
[node name="AmmoCurrent" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"]
layout_mode = 2
theme = ExtResource("1_22trs")
theme_override_constants/outline_size = 15
text = "XXX"
horizontal_alignment = 2
[node name="Label" type="Label" parent="GunInfo/VBoxContainer/HBoxContainer"]
[node name="Label" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"]
layout_mode = 2
theme_override_constants/outline_size = 15
text = "-"
[node name="AmmoReserve" type="Label" parent="GunInfo/VBoxContainer/HBoxContainer"]
[node name="AmmoReserve" type="Label" parent="GunInfo/VBoxContainer/AmmoCounter"]
layout_mode = 2
theme = ExtResource("1_22trs")
theme_override_colors/font_shadow_color = Color(0, 0, 0, 1)

View File

@@ -27,4 +27,3 @@ func hit(bullet_damage):
func _on_body_entered(body: Node3D) -> void:
hit(body.bullet_damage)
SignalBus.emit_signal("enemy_hit")
body.despawn()

View File

@@ -19,9 +19,10 @@ var crosshair_target
@onready var stamina_bar: TextureProgressBar = $StaminaBar
@onready var stamina_bar_2: ProgressBar = $StaminaBar2
@onready var health_bar: ProgressBar = $HealthBar
@onready var ammo_counter: HBoxContainer = $GunInfo/VBoxContainer/AmmoCounter
@onready var gun_name: Label = $"GunInfo/VBoxContainer/Gun Name"
@onready var ammo_current: Label = $GunInfo/VBoxContainer/HBoxContainer/AmmoCurrent
@onready var ammo_reserve: Label = $GunInfo/VBoxContainer/HBoxContainer/AmmoReserve
@onready var ammo_current: Label = $GunInfo/VBoxContainer/AmmoCounter/AmmoCurrent
@onready var ammo_reserve: Label = $GunInfo/VBoxContainer/AmmoCounter/AmmoReserve
@onready var gun_info: MarginContainer = $GunInfo
@onready var money: Label = $Money
@onready var crosshair: TextureRect = $Crosshair
@@ -114,10 +115,11 @@ func _process(delta: float) -> void:
if player.gun != null:
if GameGlobals.gun_ammo.has(player.gun.gun_name) and GameGlobals.gun_ammo[player.gun.gun_name] != null:
ammo_counter.visible = true
ammo_current.text = str(GameGlobals.gun_ammo[player.gun.gun_name]).pad_zeros(2)
lerp_color(ammo_current,RED_COLOR,FULL_WHITE,GameGlobals.gun_ammo[player.gun.gun_name],player.gun.max_ammo,.5)
else:
ammo_current.text = "-"
ammo_counter.visible = false
if GameGlobals.ammo_reserve.has(str(player.gun.ammo_type)):
ammo_reserve.text = str(GameGlobals.ammo_reserve[str(player.gun.ammo_type)]).pad_zeros(3)
lerp_color(ammo_reserve,RED_COLOR,FULL_WHITE,GameGlobals.ammo_reserve[str(player.gun.ammo_type)],player.gun.max_ammo*2,.5)

View File

@@ -1,4 +1,4 @@
extends Area3D
extends Node
var bullet_damage
@@ -8,8 +8,3 @@ var bullet_damage
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
bullet_damage = machete.bullet_damage
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass

View File

@@ -39,7 +39,7 @@ func _ready():
func _process(_delta):
if blade_ray.is_colliding():
var body = blade_ray.get_collider()
if body.has_method("hit"):
if body != null and body.has_method("hit"):
body.hit(bullet_damage)
func shoot(delta):