September 2014
Beginner
266 pages
5h 38m
English
You can add the previous code in the fireRocket function in the HelloWorldScene.cpp file and then build and run it. You will see the particles getting generated at the origin, but the explosion is a bit huge and looks very colorful. Let's make some changes so that it looks like a muzzle smoke.
Between the create and addchild functions, add the following:
m_emitter->setPosition(ccpAdd(hero->getPosition(), ccp(hero->getContentSize().width/2 ,0 ))); m_emitter->setStartColor(ccc4f(1.0, 1.0, 1.0, 1.0)); m_emitter->setEndColor(ccc4f(0.0, 0.0, 0.0, 0.0)); m_emitter->setTotalParticles(10); m_emitter->setLife(0.25); m_emitter->setSpeed(2.0); m_emitter->setSpeedVar(30.0);
We take the current position of the hero and add ...
Read now
Unlock full access