No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

scoreUI.gd 661B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. extends Control
  2. onready var label : Label = $MarginContainer/Label
  3. var game_mode
  4. var max_time = 3
  5. func _ready():
  6. Signals.connect("update_score",self,"update_score")
  7. func update_score(score: int):
  8. label.text = String(score)
  9. func start(mode: String):
  10. match mode:
  11. "score":
  12. update_score(0)
  13. show()
  14. "time":
  15. update_score(max_time)
  16. show()
  17. var t = Timer.new()
  18. t.set_wait_time(1)
  19. add_child(t)
  20. t.start()
  21. for n in range(max_time,0,-1):
  22. update_score(n)
  23. yield(t,"timeout")
  24. update_score(0)
  25. Signals.emit_signal("win")
  26. _:
  27. print("game_mode not recognized by scoreUI")
  28. func init(mode):
  29. game_mode = mode
  30. hide()