0 votes


i have followed this youtube tutorial but i wanted to add an explosion upon the fireball contact with the wall

func onbodyentered(body):

i have implemented this code but it doesn't work can anybody help me?

Godot version Godot 3.3.3
in Engine by (12 points)

1 Answer

0 votes

You are not giving the animated sprite enough time to play the animation. Because in the frame when you say that the animation should play, the object deletes itself and with it the animated sprite.

Try this:

func on body enter (body):
  yield(get_tree().create_timer(animation_lenght), "timeout")
  queue free()

animation_lenght is the length of your animation, which you have to find out yourself.

Sorry if I made mistakes, my English isnĀ“t very good.

by (80 points)

or use the animation signal:

func onanimationfinished():

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 Frequently asked questions and 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 [email protected] with your username.