animation for the fire ball, i don't know how do this

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Snayk

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 set_fireball_direction(dir):
direction = dir
if dir == -1:
$fire_sprite.flip_h = true

func _process(delta):
velocity.x = SPEED * delta * direction
translate(velocity)
$fire_sprite.play(“Fire”)

func _on_notifier_screen_exited():
queue_free()

func _on_Fire_body_entered(body):
$fire_sprite.play(“Off”)

func _on_fire_sprite_animation_finished():
queue_free()

:bust_in_silhouette: Reply From: Leon

I done it for tds right 2 days ago.
But i use the boom animation
for fireball dying.
If you mean, you don’t know how to draw it you
can find it in the web or email me for my sprites or
We can talk about making new sprites for you

:bust_in_silhouette: Reply From: Magso

The “Fire” animation is in process so “Off” only gets to play for a single frame. $fire_sprite.play("Fire") either needs to go in ready or a condition that will happen for a single frame e.g.

func process(delta):
    if myBool == true:
        $fire_sprite.play("Fire")
        myBool = false
        #won't happen again until myBool is set to true.

Thanks bro!!

Snayk | 2019-11-23 01:01