23 lines
542 B
GDScript3
Raw Normal View History

extends AnimationBase
2024-05-03 19:45:30 -04:00
2024-05-04 11:48:54 -04:00
@export var explodeDur: float = 0.2
@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):
if (exploding):
2024-05-04 11:48:54 -04:00
timer += delta
if timer > explodeDur:
self.queue_free()
2024-05-03 19:45:30 -04:00
func die() -> void:
particles.position = ballofayr.position
2024-05-04 11:48:54 -04:00
ballofayr.hide()
particles.emitting = true
exploding = true
timer = 0