HUD.gd 550 B

12345678910111213141516171819202122232425262728293031
  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. $MessageLabel.text = "Dodge again ?"
  11. $MessageLabel.show()
  12. yield(get_tree().create_timer(1.0), "timeout")
  13. $ColorButton.show()
  14. func update_score(score):
  15. $ScoreLabel.text = str(score)
  16. func _on_MessageTimer_timeout():
  17. $MessageLabel.hide()
  18. func _on_StartButton_pressed():
  19. $ColorButton.hide()
  20. emit_signal("start_game")