I have found this link for understanding how to create animation path for sprite using Adobe tools and plist file. But I still can't figure out how to create parser for this file. Is there already made solution how to do it or do I need to create it in my own?
This will parse the file, load the texture, and create all the spriteFrame objects you need:
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:#"myFrames.plist"];
Related
I loaded a .fbx object named "plane" into my content folder. I have an empty Actor on the scene with an Added C++ Scene Component. Using the C++ code, I'd like to access my .fbx object "Plane" and load it to the scene through CODE. Much like in unity ex:
Instantiate(Resources.Load(FILEPATH),new Vector3(x,y,z),new Quaternion());
You can't just place a fbx file into your level, you have to use an actor for that. Add a static mesh component to your actor and on this component set the mesh to your fbx asset.
You can not directly load stuff from files in C++, you have to use the names from imported assets. The whole point of this is that you can move files and assets around without your code breaking.
I've been working really hard for weeks now trying to get sprite sheet animation to work, and it isn't. I've tried, using this wiki page, http://www.cocos2d-x.org/wiki/Sprite_Sheet_Animation, and I've tried to make my own code, and neither have gotten e remotely close to where I want to be and I really have no idea what I'm doing here. Any help will be welcomed, and greatly appreciated. Thanks in advance.
For sprite sheet animation you have to make a plist for all your images.
Download texture packer : https://www.codeandweb.com/texturepacker
After installing the texture packer, add sprites to it and publish it.
It will create a plist.
Add that plist and png to the resources folder of your project.
Now add the following code to the init() of your GameLayer :
SpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("BowArrow.plist");
for (int i = 1; i <= 9; i++) {
frame = String::createWithFormat("Bow%d.png", i);
frames.pushBack(
SpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(
frame->getCString()));
}
Now you have all the sprites of plist in a framecache and you can run animation on them in the way you want.
I hope it helps.
You can make animations using GIF, i made so in my game and never had performance issues, you can make a GIF from web GIF Maker
I know it's possible to create texture by Smart Sprite feature in CocosBuilder 3.0. But it's very unstable now. So I decided to use TexturePacker to generate the texture. My .plist and .png files are generated into different folders for different resolution inside my CocosBuilder project folder like this:
The problem is only the .png files shown in CocosBuilder (I can't find the .plist file):
Of course if I move the .png and .plist file into Resources folder. Both are will be shown inside CocosBuilder. But I have no way to select correct image for different resolution any more. I don't know what wrong with it. Any idea?
Thank you so much.
I sovled the problem. Actually it's because the folder structure. The CocosBuilder doesn't recognize resources-iphone folder. So I rearranged the folder structure like this. Then everything is fine.
I'm trying to use the Tiled application on OSX to create a tile background for a 2d iPhone game I'm working on. I need some way to export the completed background to a .plist file so that I can use it directly with cocos2d and the app I'm writing. Unfortunately, the only export options available are:
.dat
.txt
.json
.lua
.wlk
Is there any way to easily convert any of the above formats to a more usable .plist format? Thanks a lot for your help!
You mean the Tiled Map Editor? Cocos2d iPhone supports the TMX maps natively. Just save the TMX and load it with the CCTMXTiledMap class.
Is it possible to run .gif file in cocos2d for iphone
CCSpriteSheet works really well for animating with spritesheets, you'll need a way to generate the spritesheet from the animated gif.
Read this.
I assume you mean an animated GIF. If so, no, not directly, but you could extract the frames and run them using any of the usual animation classes.