extends "res://Scripts/animationBase.gd" @export var startPrimaryLoc: Vector2 @export var startSecondaryLoc: Vector2 @export var fullSize: float = 1 @export var explodeDur: float = 0.2 @onready var ballofayr: AnimatedSprite2D = $Path2D/PathFollow2D/AnimatedSprite2D @onready var path: PathFollow2D = $Path2D/PathFollow2D @onready var particles: GPUParticles2D = $Path2D/PathFollow2D/GPUParticles2D var dir: int = 1 var exploding: bool = false var timer: float = 0 var size: Vector2 = Vector2(0, 0) # Called when the node enters the scene tree for the first time. func _ready(): if inverted: dir = -1 ballofayr.position = startSecondaryLoc # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): if !exploding: if (targetProg / finalProg < 0.3): timer = clampf(timer + delta, 0, clampf(targetProg / finalProg, 0, 0.25)) path.progress_ratio = timer if (targetProg / finalProg < 0.9): ballofayr.scale = lerp(ballofayr.scale, Vector2((targetProg / finalProg) * fullSize, (targetProg / finalProg) * fullSize), delta * 2) if (targetProg / finalProg >= 0.9): timer = clampf(timer + delta, 0, targetProg / finalProg) path.progress_ratio = timer if path.progress_ratio == 1: explode() else: timer += delta if timer > explodeDur: self.free() func explode() -> void: ballofayr.hide() particles.emitting = true exploding = true timer = 0 func castFailed() -> void: explode()