extends Control @onready var texture = $texture @onready var amountLabel = $Label @onready var progressRect = $progress @export var imDead := false var upgradeID := "" #var amount := 1 var timer := Globals.UPGRADE_TIMERSTART func _process(delta: float) -> void: if imDead and not $particles.emitting: queue_free() timer -= delta * Engine.time_scale texture.scale += (Vector2(1, 1) - texture.scale) * 7 * delta texture.modulate.a += (1 - texture.modulate.a) * 7 * delta progressRect.position.x += (timer / Globals.UPGRADE_TIMERSTART * 48 - progressRect.position.x) * 5 * delta progressRect.size.x += (48 - timer / Globals.UPGRADE_TIMERSTART * 48 - progressRect.size.x) * 5 * delta amountLabel.text = str("x", Globals.unlockedUpgrades.get(upgradeID, -1)) if timer < 0 and not imDead: Globals.unlockedUpgrades[upgradeID] -= 1 timer = Globals.UPGRADE_TIMERSTART if Globals.unlockedUpgrades[upgradeID] == 0: Globals.unlockedUpgrades.erase(upgradeID) imDead = true $texture.hide() $progress.hide() $Label.hide() $goldrect.hide() $breaksfx.play() $particles.emitting = true