godot-shooter / change-html-template / files / HUD.gd
Branch change-html-template · default branch · all branches
HUD.gd
| 1 | extends Control |
| 2 | |
| 3 | export var score = 0 |
| 4 | |
| 5 | func _ready() -> void: |
| 6 | $AnimationPlayer.play("instructions fade") |
| 7 | |
| 8 | func _process(_delta: float) -> void: |
| 9 | $VBoxContainer/HBoxContainer/Score.text = "%s" % score |
| 10 | if Input.is_action_just_pressed("exit"): |
| 11 | if OS.get_name() == "OSX": |
| 12 | get_tree().quit() |
| 13 | else: |
| 14 | restart() |
| 15 | if Input.is_action_just_pressed("restart"): |
| 16 | restart() |
| 17 | |
| 18 | func restart(): |
| 19 | var _error = get_tree().reload_current_scene() |
| 20 | get_tree().paused = false |