Animation not working when saved as a scene

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

So i am really noob in godot, and i wanted to do a animated fireplace for my game.
I made it like this
enter image description here

and saved it as a scene(i think its supost to do it) , it works on the scene i made it

but not in the main scene, were its like theres not even an animation
It also doent work in play mode

That seems to be an odd scene structure for an animated fire. Are you trying to do some kind of collision detection with your fire? Assuming not, I’m not sure why you want/need the RigidBody2D and CollisionPolygon2D nodes. Also, I don’t know why you need the Sprite node since you have an AnimatedSprite2D node. Depending on your needs, I’d probably simplify that scene down to only what you need for starters.

jgodfrey | 2023-04-11 23:06

Im using the colision just so the player doesnt go trough the fire
enter image description here

ZeTugs | 2023-04-11 23:15

I’m using the colision just so the player doesnt go trough the fire

Ah, yeah - makes sense.

You need to either have the Autoplay on load button checked in Sprite Frames Editor (near the left edge of the toolbar in the Sprite Frames Editor) or you need to play the animation via a script from code.

jgodfrey | 2023-04-12 00:58

I made a script like u said, works like a charm tks

ZeTugs | 2023-04-12 08:48

:bust_in_silhouette: Reply From: jgodfrey

Based on the above discussion, the answer here is to do one of:

  • Set the AnimatedSprite2D to autoplay (via the Sprite Frames Editor), or…
  • Call the AnimatedSprite2D nodes play() function from a script.