I want to put a animation for the fire ball when it touch any body, a animation of the fire dying but i don't know how do this
This is the script of the fire ball:
OBS: The animation called "Off" is the dying fire animation
extends Area2D
const SPEED = 180
var velocity = Vector2()
var direction = 1
func _ready():
pass
func setfireballdirection(dir):
direction = dir
if dir == -1:
$firesprite.fliph = true
func process(delta):
velocity.x = SPEED * delta * direction
translate(velocity)
$firesprite.play("Fire")
func onnotifierscreenexited():
queue_free()
func onFirebodyentered(body):
$fire_sprite.play("Off")
func onfirespriteanimationfinished():
queuefree()