i’m trying to make a tower defence game, when i tried to setup a auto coin increaser, it just goes to max straight away for some reason.
extends Node2D
var coins = 0
var maxcoins = 1000
func _ready():
increasecoins()
func increasecoins():
while coins < maxcoins:
get_tree().create_timer(100).timeout
coins = coins + 1
$CoinDisplay/Label.text = str(coins) + "/" + str(maxcoins)
i mean it work but it’s too fast and the wait doesn’t seem to work on this