0 votes

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)
$fire
sprite.play("Fire")

func onnotifierscreenexited():
queue_free()

func onFirebodyentered(body):
$fire_sprite.play("Off")

func onfirespriteanimationfinished():
queue
free()

in Engine by (21 points)

2 Answers

+1 vote
Best answer

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.
by (3,201 points)
selected by

Thanks bro!!

0 votes

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

by (13 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.