System żyć - Game Label

 avatar
TaktycznyBocian
plain_text
2 years ago
354 B
0
Indexable
Never
extends Node2D

var lives = 4
var seconds = 0
func _on_Fail_body_entered(body):
	if body.is_in_group("Ball"):
		lives -= 1
		get_node("Live").set_text("Lives: " + str(lives))
	if lives == 0:
		get_tree().change_scene("res://UI/GameOver.tscn")



func _on_Timer_timeout():
	seconds += 1
	get_node('Time').set_text('Time: ' + str(seconds))