Dodge - cleanup. Added Survivor. /JL
This commit is contained in:
39
dodge/scripts/hud.gd
Normal file
39
dodge/scripts/hud.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
extends CanvasLayer
|
||||
|
||||
# Notifies `Main` node that the button has been pressed
|
||||
signal start_game
|
||||
|
||||
func show_message(text):
|
||||
$Message.text = text
|
||||
$Message.show()
|
||||
$MessageTimer.start()
|
||||
|
||||
func show_game_over():
|
||||
show_message("Game Over")
|
||||
# Wait until the MessageTimer has counted down.
|
||||
await $MessageTimer.timeout
|
||||
|
||||
$Message.text = "Dodge the Creeps!"
|
||||
$Message.show()
|
||||
# Make a one-shot timer and wait for it to finish.
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
$StartButton.show()
|
||||
|
||||
func update_score(score):
|
||||
$ScoreLabel.text = str(score)
|
||||
|
||||
func _on_start_button_pressed():
|
||||
$StartButton.hide()
|
||||
start_game.emit()
|
||||
|
||||
func _on_message_timer_timeout():
|
||||
$Message.hide()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
Reference in New Issue
Block a user