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 * pow(1.5, Globals.unlockedUpgrades.get("stopwatch", 0)) var goldUpgrade := false func _ready(): if goldUpgrade: progressRect.hide() $goldrect.show() timer = 999 func _process(delta: float) -> void: if imDead and not $particles.emitting: queue_free() if not goldUpgrade: 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", amount)#Globals.unlockedUpgrades.get(upgradeID, -1)) if timer < 0 and not imDead: amount -= 1 Globals.unlockedUpgrades[upgradeID] -= 1 timer = Globals.UPGRADE_TIMERSTART if amount == 0: #Globals.unlockedUpgrades.erase(upgradeID) imDead = true $texture.hide() $progress.hide() $Label.hide() $goldrect.hide() $breaksfx.play() $particles.emitting = true