Animations and sheetObject

May 14, 2013 at 7:34 AM

Could you advice method to show animations for sheetObject? For example I have sheetObject with sprite of ship. I want to show 20 frames of explosion (near the ship) and then hide the animation (not the ship). Which method should I use for such things?

I tried to create additional hidden sheet in sheetObject for animations and after finishing an animation I hide the sheet in sheetObject. But I suppose that this method a little bit perverse.

Could I add a sheet into sheetObject after creating sheetObject and then remove this sheet?

And sorry for grammer, english is not my mother tongue.
May 14, 2013 at 12:23 PM
Maybe you can add a sheet to the object, that have a transparent image as first and last frame of the animation.
You don't have to hide it, but it's invisible unless you need it and you animate it.
May 16, 2013 at 12:39 PM
I wouldn't suggest dynamically manipulating the object's sheet array in-game. Try to include every sheet of the object when you create it, they can be hidden and later displayed (see Moving object sheets paragraph in Animating objects chapter in the documentation).

For random explosions however I would suggest you create new objects that appear when the explosion happens and disappear when the animation is done. Check out the Crossyards Arena game: the rocket's fired by players are exploded in this manner. I create objects for the explosions when the scene is initialized and hide them all. Whenever I need to display an explosion I move one explosion object to the right location, display it and display some animation on it, also move it while animating and then hide it. Check for "Rockets and shooting" paragraph in the following description:

Online demo here: