25 lines
381 B
GDScript
25 lines
381 B
GDScript
extends CanvasLayer
|
|
|
|
|
|
var score: int
|
|
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
$ScoreTimer.connect("timeout", self, "_ScoreTimer_timeout")
|
|
|
|
|
|
func _ScoreTimer_timeout():
|
|
score += 1
|
|
$Score.text = str(score)
|
|
|
|
|
|
func new_game():
|
|
score = 0
|
|
$ScoreTimer.start()
|
|
$State.text = ""
|
|
|
|
func end_game():
|
|
$ScoreTimer.stop()
|
|
$State.text = "VICTIORE"
|