-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameOver.gd
More file actions
28 lines (22 loc) · 1020 Bytes
/
Copy pathGameOver.gd
File metadata and controls
28 lines (22 loc) · 1020 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends CanvasLayer
signal restart_requested
@onready var reason_label = $Panel/VBox/ReasonLabel
@onready var level_label = $Panel/VBox/StatsContainer/LevelLabel
@onready var best_label = $Panel/VBox/StatsContainer/BestLabel
@onready var gold_label = $Panel/VBox/StatsContainer/GoldLabel
@onready var restart_button = $Panel/VBox/RestartButton
func setup(current_level: int, best_level: int, reason: String, gold_earned: Big = null):
reason_label.text = reason
level_label.text = "Reached Level %d" % current_level
best_label.text = "Best: Level %d" % best_level
if gold_earned != null and gold_earned.signum() > 0:
gold_label.text = "+%s Gold" % gold_earned.format(1000000000.0)
gold_label.visible = true
else:
gold_label.visible = false
# Simple pop-in animation
$Panel.scale = Vector2.ZERO
var tween = create_tween().set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
tween.tween_property($Panel, "scale", Vector2.ONE, 0.4)
func _on_restart_button_pressed():
emit_signal("restart_requested")