-1

I've decided to create my own particle system because my customer has specific wishes as for visual performance. I'd chosen standard architecture, one class is a ParticleSystem which contains particles and second class is ParticleElement which contains methods for handling a particle. BUT, right now I've made "ParticleElement" class a heritor of Sprite, but I'm pretty sure that was wrong solution) So, my question is - how would you recommend to build the class for Particle? What cocos2d-x class should I pick for inheritance? What way need to be picked for visual performance (render the texture)? I appreciate any help from you guys.

Eugene Alexeev
  • 1,152
  • 12
  • 32

2 Answers2

2
    cocos2d::ParticleSystemQuad *m_emitter;
    m_emitter=ParticleSystemQuad::create("file.plist");
    m_emitter->setVisible(true);
    this->addChild(m_emitter,50);
    m_emitter->setPosition(ccp(512,384));  
m_emitter->runAction(Sequence::create(DelayTime::create(3.0),RemoveSelf::create(), NULL));
1

try out this url http://particle2dx.com/. It gives you a plist for the particle system which you can easily import into cocos2d-x using

_emitter = ParticleSystemQuad::create("Particles/SpinningPeas.plist");
_emitter->setTextureWithRect(Director::getInstance()->getTextureCache()->addImage("Images/particles.png"), Rect(0,0,32,32));
addChild(_emitter, 10);
sanchitgulati
  • 456
  • 2
  • 8
  • Thank you for your response. I saw this site and it's really great but it can't give me what I want. I need a "special behavior" of particles. I've already made them, but right now my Particle elements are single sprites what doesn't sound good for optimization I guess. So I want to know how I can make ParticleElement class more "easier" for the application. – Eugene Alexeev May 28 '15 at 09:11