DuckRun/code/hiscore.gd

19 lines
437 B
GDScript3
Raw Normal View History

extends Label
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
text = str($"/root/Global".hiscore)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func set_new_hiscore():
if int(text) < int(%ScoreContainer/text.text):
text = %ScoreContainer/text.text
$"/root/Global".write_save()
func get_score():
return int(text)