Time for action – creating particle systems
For particles, all we need is the XML file describing the particle system's properties.
So let's go to
GameLayer.cpp
.The game initializes by calling
createGameScreen
, which is already in place, thencreateParticles
andcreateStarGrid
, which is also implemented. So let's go over thecreateParticles
method now.Go to that method in
GameLayer.cpp
and add the following code:_jet = ParticleSystemQuad::create("jet.plist"); _jet->setSourcePosition(Vec2(-_rocket->getRadius() * 0.8f,0)); _jet->setAngle(180); _jet->stopSystem(); this->addChild(_jet, kBackground); _boom = ParticleSystemQuad::create("boom.plist"); _boom->stopSystem(); this->addChild(_boom, kForeground); _comet = ParticleSystemQuad::create("comet.plist"); _comet->stopSystem(); _comet->setPosition(Vec2(0, _screenSize.height * 0.6f)); _comet->setVisible(false); this->addChild(_comet, kForeground); _pickup = ParticleSystemQuad::create("plink.plist"); _pickup-...