aboutsummaryrefslogtreecommitdiffstats
path: root/Scripts/UI_Control.gd
diff options
context:
space:
mode:
authorLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-09 16:24:34 +0200
committerLibravatar IcECreAm777 <hgk.1998@googlemail.com>2023-07-09 16:24:34 +0200
commit1782e704c10c4ddf2955f72dd32ca4d068aec3e0 (patch)
tree169ac3bbb00b91044de0542701cf397c94e0f2ca /Scripts/UI_Control.gd
parentbcccb662566481ea5956e40086e894aa8543f665 (diff)
download2023-1782e704c10c4ddf2955f72dd32ca4d068aec3e0.tar.gz
2023-1782e704c10c4ddf2955f72dd32ca4d068aec3e0.tar.bz2
2023-1782e704c10c4ddf2955f72dd32ca4d068aec3e0.zip
medal system
Diffstat (limited to 'Scripts/UI_Control.gd')
-rw-r--r--Scripts/UI_Control.gd20
1 files changed, 19 insertions, 1 deletions
diff --git a/Scripts/UI_Control.gd b/Scripts/UI_Control.gd
index b7ce2a5..a45503a 100644
--- a/Scripts/UI_Control.gd
+++ b/Scripts/UI_Control.gd
@@ -5,6 +5,10 @@ extends Control
@onready var time_label = $InGameUI/CurrentTime
+@onready var gold_sprite: AnimatedSprite2D = $PostGameUI/Gold
+@onready var silver_sprite: AnimatedSprite2D = $PostGameUI/Silver
+@onready var bronze_sprite: AnimatedSprite2D = $PostGameUI/Bronze
+
func update_timer_label(new_time: float):
if(new_time < 0):
@@ -12,14 +16,28 @@ func update_timer_label(new_time: float):
return
time_label.text = str(new_time).pad_decimals(3)
-func switch_to_post_game_UI():
+func switch_to_post_game_UI(medal: int):
in_game_ui.visible = false
post_game_ui.visible = true
$PostGameUI/FinalTime.text = time_label.text
+
+ if medal == 0:
+ gold_sprite.visible = true
+ gold_sprite.play("default")
+ elif medal == 1:
+ silver_sprite.visible = true
+ silver_sprite.play("default")
+ elif medal == 2:
+ bronze_sprite.visible = true
+ bronze_sprite.play("default")
func switch_to_in_game_UI():
in_game_ui.visible = true
post_game_ui.visible = false
+
+ gold_sprite.visible = false
+ silver_sprite.visible = false
+ bronze_sprite.visible = false
func _on_start_button_pressed():
var root = owner.owner