This commit is contained in:
derek
2025-02-26 09:17:21 -06:00
15 changed files with 128 additions and 47 deletions

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

@@ -41,7 +41,7 @@ func money_penalty():
func weapon_penalty():
var level_control = get_tree().current_scene
GameGlobals.ammo_reserve = {}
match level_control.gamemode.weapon_penalty:
0: #Drop All
GameGlobals.held_guns = []

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
@@ -50,6 +51,8 @@ func _ready() -> void:
SignalBus.player_hit.connect(player_hit)
SignalBus.shot_fired.connect(crosshair_size_change)
money_count = GameGlobals.money
health_bar.max_value = level_control.gamemode.start_health
health_bar_start_pos = health_bar.position
@@ -112,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):