Game created during The Indie Tales Jam https://pinkduck-oleksiy.itch.io/chores-with-cranberry
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

22 lines
579 B

extends Label
onready var Dirt = get_parent().get_parent().get_node("Dirt") #get_node("/root/Main/Level/Dirt")
var total
var current
var percent
var WinPlayed = 0
func _ready():
total = Dirt.get_child_count()
func _physics_process(_delta):
current = Dirt.get_child_count()
var cleaned = total - current
percent = (cleaned * 100 ) / total
text = String(percent) + "% CLEANED"
if (percent == 100):
get_parent().get_node("Time").stoptimer()
get_parent().get_node("WIN").visible = true
if (WinPlayed == 0):
get_parent().get_node("WinSound").play()
WinPlayed = 1