HUD.gd 501 B

12345678910111213141516171819202122232425
  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. yield($MessageTimer, "timeout")
  10. $StartButton.show()
  11. $MessageLabel.text = "Dodge the\nCreeps!"
  12. $MessageLabel.show()
  13. func update_score(score):
  14. $ScoreLabel.text = str(score)
  15. func _on_StartButton_pressed():
  16. $StartButton.hide()
  17. emit_signal("start_game")
  18. func _on_MessageTimer_timeout():
  19. $MessageLabel.hide()