Version of Robotron arcade game using LPC1768, a Gameduino shield, a serial EEPROM (for high scores), two microswitch joysticks and two buttons plus a box to put it in. 20 levels of mayhem.

Dependencies:   25LCxxx_SPI CommonTypes Gameduino mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers EnemyFactory.h Source File

EnemyFactory.h

00001 /*
00002  * SOURCE FILE : EnemyFactory.h
00003  *
00004  * Definition of class EnemyFactory.
00005  * Makes objects descended from EnemyObject.
00006  * It is absolutely vital that all enemies are created and deleted this way if memory leaks are to be avoided.
00007  * Don't forget pesky enemies like MutantObjects that only appear half way through a level. They still need
00008  * to be created this way.
00009  *
00010  */
00011 
00012 #ifndef EnemyFactoryDefined
00013 
00014   #define EnemyFactoryDefined
00015 
00016   #include "EnemyType.h"
00017   #include "GameObject.h"
00018   #include "HumanObject.h"
00019   #include "GruntObject.h"
00020   #include "CrusherObject.h"
00021   #include "BrainObject.h"
00022   #include "MutantObject.h"
00023   #include "BlueMeanyObject.h"
00024 
00025   class EnemyFactory {
00026 
00027   public :
00028 
00029     // An instance of this class.
00030     static EnemyFactory Instance;
00031     
00032     /***************/
00033     /* CONSTRUCTOR */
00034     /***************/
00035     EnemyFactory();
00036 
00037     /**************/
00038     /* DESTRUCTOR */
00039     /**************/
00040     virtual ~EnemyFactory();
00041 
00042     /*****************/
00043     /* MAKE AN ENEMY */
00044     /*****************/
00045     // Pass enemy type in et.
00046     // Returns a newly created object or NULL on failure.
00047     EnemyObject* MakeEnemy( EnemyType et );
00048 
00049     /*******************/
00050     /* DELETE AN ENEMY */
00051     /*******************/
00052     // Pass pointer to enemy to delete.
00053     // ONLY USE THIS ON OBJECTS CREATED USING MakeEnemy method.
00054     void DeleteEnemy( EnemyObject *enemy );
00055 
00056   private :
00057   
00058     // Number of enemies created.
00059     unsigned long enemyCount;
00060         
00061   };
00062 
00063 #endif
00064 
00065 /* END of EnemyFactory.h */
00066 
00067