How can I create an empty ParticleSystem and add child particlesystemquad on it like CCNode

330 views Asked by At

I'm making a game using cocos2d-x 3.0 alpha, and I want it to create empty ParticleSystem object(root A) and add many ParticleSystemQuads on it as children. so I would be able to change position and scale, etc., by just changing root A only.

so I made root ParticleSystem like

ParticleSystem *A = ParticleSystem::create();

It has no error but it crashes because I didn't put plist file name. I tested with plist file name and it works, but I had to put any file to do that(of course I can do trick like moving root A particle outside from screen).

How can I make empty ParticleSystem onject like CCNode? I can just use CCNode but I want to use stopSystem() and resetSystem() methods which is in ParticleSystem class. That's why.

1

There are 1 answers

0
dg_no_9 On

You may go like this way:

CCParticleSystemQuad* sun = CCParticleSun::create();
CCParticleSystemQuad* fire = CCParticleFire::create();

CCNode* root = CCNode::create();
root->addChild(sun);
root->addChild(fire);
root->setPosition(ccp(100,100));
root->setScale(2.0);

scene->addChild(root);