2024-05-13 22:38:17 -04:00
|
|
|
extends AnimationBase
|
2024-05-03 19:45:30 -04:00
|
|
|
|
2024-05-04 11:48:54 -04:00
|
|
|
@export var explodeDur: float = 0.2
|
2024-05-13 22:38:17 -04:00
|
|
|
@onready var ballofayr: AnimatedSprite2D = $AnimatedSprite2D
|
|
|
|
@onready var particles: GPUParticles2D = $GPUParticles2D
|
|
|
|
|
2024-05-04 11:48:54 -04:00
|
|
|
var exploding: bool = false
|
2024-05-03 19:45:30 -04:00
|
|
|
var timer: float = 0
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
|
|
func _process(delta):
|
2024-05-13 22:38:17 -04:00
|
|
|
if (exploding):
|
2024-05-04 11:48:54 -04:00
|
|
|
timer += delta
|
|
|
|
if timer > explodeDur:
|
2024-05-13 22:38:17 -04:00
|
|
|
self.queue_free()
|
2024-05-03 19:45:30 -04:00
|
|
|
|
2024-05-14 21:40:18 -04:00
|
|
|
func die() -> void:
|
2024-05-13 22:38:17 -04:00
|
|
|
particles.position = ballofayr.position
|
2024-05-04 11:48:54 -04:00
|
|
|
ballofayr.hide()
|
|
|
|
particles.emitting = true
|
|
|
|
exploding = true
|
|
|
|
timer = 0
|