HUD.gd 535 B

123456789101112131415161718192021222324252627282930
  1. extends CanvasLayer
  2. signal start_game
  3. func show_message(text):
  4. $MessageLabel.text = text
  5. $MessageLabel.show()
  6. $MessageTimer.start()
  7. func show_game_over():
  8. show_message("Game Over")
  9. await $MessageTimer.timeout
  10. $MessageLabel.text = "Dodge the\nCreeps"
  11. $MessageLabel.show()
  12. await get_tree().create_timer(1).timeout
  13. $StartButton.show()
  14. func update_score(score):
  15. $ScoreLabel.text = str(score)
  16. func _on_StartButton_pressed():
  17. $StartButton.hide()
  18. start_game.emit()
  19. func _on_MessageTimer_timeout():
  20. $MessageLabel.hide()