cocos2d-xparticlesccparticlesystem

Can Someone Give Me A Simple COcos2d-X Particle Example?


I just want to make a CCParticleExplsion using Cocos2d-x and C++, but can't seem to find it after searching all over. ObjC example:

CCParticleSystem *firework = [[CCParticleExplosion alloc] initWithTotalParticles:200];
[self addChild:firework];
[firework setTexture:[[CCTextureCache sharedTextureCache] addImage:@"star.png"]];

Solution

  • In most cases, the ParticleTexture comes with the plist file, and the whole plist file is from the particle designer. Usually, we use

    CCParticleSystemQuad* p = CCParticleSystemQuad::create("whatever_particle.plist");
    this->addChild(p);
    

    but if you wanna use the particles comes with cocos2d-x, you can check how to use them in the Test Cases that comes with the cocos2d-x framework. the file name is ParticleTest.cpp