Add classic HUD, auto reload, furniture pathfinding and death flatline
This commit is contained in:
+10
-13
@@ -10,7 +10,8 @@ var room: Node3D
|
||||
var music: AudioStreamPlayer
|
||||
var music_started := false
|
||||
var touch: Node
|
||||
var hud: Label
|
||||
var hud: CanvasLayer
|
||||
var navigation: Node
|
||||
var score := 0
|
||||
var wave := 0
|
||||
var alive := 0
|
||||
@@ -46,12 +47,14 @@ func _ready() -> void:
|
||||
var office := Node3D.new()
|
||||
office.set_script(preload("res://scripts/office_atmosphere.gd"))
|
||||
add_child(office)
|
||||
navigation = Node.new()
|
||||
navigation.set_script(preload("res://scripts/room_navigation.gd"))
|
||||
add_child(navigation)
|
||||
var canvas := CanvasLayer.new()
|
||||
add_child(canvas)
|
||||
hud = Label.new()
|
||||
hud.position = Vector2(24, 20)
|
||||
hud.add_theme_font_size_override("font_size", 24)
|
||||
canvas.add_child(hud)
|
||||
hud = CanvasLayer.new()
|
||||
hud.set_script(preload("res://scripts/game_hud.gd"))
|
||||
add_child(hud)
|
||||
var cross := Label.new()
|
||||
cross.text = "+"
|
||||
cross.add_theme_font_size_override("font_size", 30)
|
||||
@@ -141,14 +144,7 @@ func _restart_music() -> void:
|
||||
|
||||
func _process(_dt: float) -> void:
|
||||
if hud:
|
||||
hud.text = "VITA %d MUNIZIONI %d/30 ONDATA %d PUNTI %d\nWASD · mouse · sinistro: spara · destro: granata · R: ricarica · spazio: salto · Esc: mouse" % [player.hp, player.ammo, wave, score]
|
||||
hud.text += "\nGRANATA: " + ("PRONTA" if player.grenade_cooldown <= 0 else "%d s" % ceili(player.grenade_cooldown))
|
||||
if player.reloading:
|
||||
hud.text += "\nRICARICA..."
|
||||
if player.touch_mode:
|
||||
hud.text += "\ntrascina a sinistra: muovi · a destra: guarda"
|
||||
if player.hp <= 0:
|
||||
hud.text += "\nSEI MORTO — tocca RICOMINCIA" if player.touch_mode else "\nSEI MORTO — premi R per ricominciare"
|
||||
hud.update_status(player, wave, score)
|
||||
|
||||
func zombies_for_wave(number: int) -> int:
|
||||
return 4 + number * 2
|
||||
@@ -173,6 +169,7 @@ func _spawn(index: int) -> void:
|
||||
var zombie := CharacterBody3D.new()
|
||||
zombie.set_script(ZombieScript)
|
||||
zombie.player = player
|
||||
zombie.navigation = navigation
|
||||
zombie.position = centers[index] - inward * 1.2
|
||||
add_child(zombie)
|
||||
alive += 1
|
||||
|
||||
Reference in New Issue
Block a user