32 lines
685 B
GDScript
32 lines
685 B
GDScript
extends CanvasLayer
|
|
|
|
var best = 0
|
|
var current = 0
|
|
|
|
var best_score;
|
|
var current_score;
|
|
var ready_text;
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
best_score = get_node("MarginContainer/HBoxContainer/BestScore")
|
|
current_score = get_node("MarginContainer/HBoxContainer/CurrentScore")
|
|
ready_text = get_node("CenterContainer/ReadyText")
|
|
|
|
func _on_Player_start():
|
|
current = 0
|
|
ready_text.hide()
|
|
update_ui()
|
|
|
|
func _on_Player_hit():
|
|
ready_text.show()
|
|
best = max(best, current)
|
|
update_ui()
|
|
|
|
func _on_Player_passed():
|
|
current += 1
|
|
update_ui()
|
|
|
|
func update_ui():
|
|
best_score.text = "Best: "+str(best)
|
|
current_score.text = "Current: "+str(current)
|