1/16/2024 0 Comments Texturepacker sprite sheet center![]() ![]() I was referring to that section specifically.Ĭreating frames from a plist is documented, as I mentioned above.Ĭreating an animation by hand is also documented, as I mentioned as well. Currently the doc explains how to load a spritesheet and it explains in a different section how to piece together an animation by hand, but it fails to address how to conventiently load an animation using a spritesheet plist and an animation plist.Īgain, if there is some way I can help to extend the Beginner’s Guide please let me know, otherwise I would be happy if someone could extend it. This is just a short extension to the documentation which unfortunately skips this part. The ist file has a different layout than the ist file and can be written by hand following.Load the animation into the AnimationCache by calling AnimationCache::getInstance()->addAnimationsWithFile(“ist”).The plist file can be automatically generated by.Load Sprites into the SpriteFrameCache by calling SpriteFrameCache::getInstance()->addSpriteFramesWithFile(“ist”).In order to define an animation in AnimationCache, its sprites must be present in the SpriteFrameCache.There are two caches, SpriteFrameCache and AnimationCache.So in order to save other people from the same headaches I had, I would propose extending the Beginner’s Guide by a section explaining how to get sprite sheet animations into the game. ![]() Luckily I stumbled upon an example from the cpp-tests project that had an animation plist file included. What made my problem worse was that there seems to be no software on PC that can write the plist file for AnimationCache and the format is not well documented (or I missed it). The problem was that I incorrectly tried to load the frame plist file into the AnimationCache. My problem was that I didn’t know that there are two caches: SpriteFrameCache and AnimationCache and that each has their own plist files and you need both to load an animation. When I tried to load them into the game, I got an error because the game did not like my plist file. So first of all, I created a plist file of my animation frames using TexturePacker (I’m on PC). It is mentioned that a better way to do this is to use plist files which reduce the amount of legwork necessary to get the animation into the game. I was trying to add a sprite animation and from scouring the internet I found out that one possible way was to load each sprite manually and then tie them together to an animation by hand. I’m very new to cocos-2d and I would like to let you know about an issue that had me stumped for a whole day and which could be improved in the documentation. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |