How to create animated sptite dynamically?
In the HaxeFlixel I can load spritesheet for animations by Sprite.LoadGraphics().
Now I need to use for animations the sprite that was created by Sprite.MakeGraphics() and filled programmatically.
How to do this?
Check this out: http://haxeflixel.com/documentation/flxsprite/
The whole thing is worth the read, but just so you know
loadgraphics(); is used to load the sprite sheet
animation.add(); is used to add animation sequences
Just read the documentation you'll understand how it works C:
Thanks. but it's not that. When you create graphics through LoadGraphics() - you can create multiple frames, which can be switched through Sprite.animation.frameIndex (and these frameIndexes are loaded in animation.add ()). When you MakeGraphics(), you do not have several frames.
Graphicargument, so you could probably use
makeGraphic()and then call
loadGraphic(pixels, true, <width>, <height>)immediately after.
Thanks! Will surely try such option.
Also, I just have looked into the sources (just forget about them :)) and saw inside it FlxTileFrames.fromFrame() which also solves the problem.
Thanks again! )