Add classic HUD, auto reload, furniture pathfinding and death flatline
This commit is contained in:
@@ -100,6 +100,8 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
|
||||
## Ricarica: tempi invariati, riusata da tastiera (R) e dal pulsante on-screen.
|
||||
func start_reload() -> void:
|
||||
if reloading or death_started or hp <= 0 or ammo >= 30:
|
||||
return
|
||||
reloading = true
|
||||
weapon_anim.play("reload")
|
||||
Audio.play(self, "items/cliprelease1.wav")
|
||||
@@ -140,6 +142,8 @@ func _physics_process(dt: float) -> void:
|
||||
get_tree().reload_current_scene() # R o pulsante Ricarica a partita finita
|
||||
return
|
||||
_regenerate_health(dt)
|
||||
if ammo <= 0 and not reloading:
|
||||
start_reload()
|
||||
_handle_actions()
|
||||
# Deadzone esplicita piccola (0.2): con la 0.5 delle azioni la corsa utile del
|
||||
# joystick touch si dimezzerebbe, mentre per tastiera/joypad nulla cambia.
|
||||
@@ -176,6 +180,8 @@ func shoot() -> void:
|
||||
if hit and hit.collider.has_method("take_damage"):
|
||||
Blood.impact(get_parent(), hit.position, -camera.global_basis.z)
|
||||
hit.collider.take_damage(35, hit.position.y)
|
||||
if ammo <= 0:
|
||||
start_reload()
|
||||
|
||||
func throw_grenade() -> RigidBody3D:
|
||||
if death_started or hp <= 0 or grenade_cooldown > 0:
|
||||
@@ -219,6 +225,7 @@ func _die() -> void:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
# Original Half-Life player pain sample used as the death event vocal.
|
||||
Audio.play(self, "player/pl_pain7.wav", false, -8)
|
||||
Audio.play(self, "fvox/flatline.wav", false, -9)
|
||||
var layer := CanvasLayer.new()
|
||||
layer.layer = 5
|
||||
add_child(layer)
|
||||
|
||||
Reference in New Issue
Block a user