system
February 22, 2011, 1:13pm
1
Could someone provide an example for loading a particle system from file. I tried the following but it did not work. The app crashes with this code:
CCParticleSystem* effect = CCParticleSystem::particleWithFile(“myeffect.plist”);
effect~~>setPosition );
this~~>addChild(effect, 3);
system
February 22, 2011, 1:58pm
2
CCParticleSystemQuad *system = new CCParticleSystemQuad();
system~~>initWithFile;
this~~>addChild(system, 3);
also doesn’t work
system
February 22, 2011, 5:42pm
3
AFAIK, cocos2d-x can’t support plist in binary format, it’s a known bug. They use libxml to parse plist file instead of CoreFoundation.
issue #349 and this post http://www.cocos2d-x.org/boards/7/topics/489?r=540#message-540 may help you.
Thank you for your help. I made it so the image binary is not included in the plist file.
In Particle Designer, I unchecked “Embed Texture” and now the code works.
CCParticleSystem *system = new CCParticleSystemQuad();
system~~>initWithFile;
this~~>addChild(system, 10);
system->setPosition(ccp(size.width/2, size.height/2));
walzer
February 23, 2011, 4:10pm
5
oh, thanks. I forget this problem.
Some embed texture can work and some are failed at the phase png loading, it’s an old bug. But I don’t know why.
So you can see in the cocos2d-x tests, I unpack the SpinningPeas.png and SpookyPeas.png out of plist file.