Creating your own particle system
In this section, we will create a small mock particle system that will create an image of the enemy and gun and make it look as if she is spinning and falling down once hit by the rocket. As we have already deleted the enemy, we just have to spawn the new enemy and gun sprites and remove it from the display list after a while. For this, we will create a class that will take an image, spin it, and make it fall down.
Create a new class called ParticleSpin
and create the respective .h
and .cpp
files. Next, add the following to the ParticleSpin.h
file:
#ifndef __wp8Game__ParticleSpin__ #define __wp8Game__ParticleSpin__ class ProjectileObject; #include <iostream> #include "cocos2d.h" using namespace cocos2d; class ParticleSpin: public CCSprite { ParticleSpin(); ~ParticleSpin(); CCPoint speed; CCPoint gravity; float spinCounter; public: bool init(); static ParticleSpin* create(CCPoint _cp, char *fileName); void update...