September 2014
Beginner
266 pages
5h 38m
English
Now that we have the enemies spawning, we want them to shoot bullets at certain intervals. The bullets will spawn wherever the enemy is currently located. Once they have spawned, they should start moving left and once they are out of the screen, they should be deleted. For this, we create a class named Projectile and add the Projectile.h and Projectile.cpp files to the Classes folder, as we did previously for the other classes.
In the Projectile.h file, add the following lines of code:
#ifndef __wp8Game__Projectile__ #define __wp8Game__Projectile__ #pragma once #include "cocos2d.h" using namespace cocos2d; class Projectile : public CCSprite { public: Projectile(void); ~Projectile(void); int type; static Projectile* ...Read now
Unlock full access