I am very new to Defold and I am trying to play an animation using msg.post.
If I set the Playback property to anything other than None in design time, the animation will work. However, if I set the Playback to None and try to start the animation in my scripts Init(), it doesn’t work…
Here is the project structure:
I have fire.atlas which contains anim animation with 3 images
fire.collection contains 16 game objects (fire01, etc) and a sprite in it. It also contains go game object containing my script where the init is called to start the animation
main.collection contains fire.collection
The init() function contains only the function call:
I set the animation playback property to “None” in design time. My assumption is that I have to do that in order to play it in runtime only. If I am wrong what is the best approach to make the animation not play on startup but only after a certain condition (in my code) ?
I added the msg.post("#sprite", "play_animation", {id = hash("anim")}) command to a script under the fire01 game object and the effect is the same…
I am sure I am missing something important here, but I can’t figure out what
Ah, set a default animation to a single image that will act as your “idle” or no animation. Then change from None to Once Forward or Loop Forward or whatever is suitable for your animation.