![](/media/cache/profiles/859bf1416b8b8761c5d588dee78dc65f.50x50_q85.jpg)
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
EnemyFactory.h@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 10:bfa1c307c99d
Improved response to button 1 when entering high scores (HighScoreEntry.cpp).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
RichardE | 10:bfa1c307c99d | 1 | /* |
RichardE | 10:bfa1c307c99d | 2 | * SOURCE FILE : EnemyFactory.h |
RichardE | 10:bfa1c307c99d | 3 | * |
RichardE | 10:bfa1c307c99d | 4 | * Definition of class EnemyFactory. |
RichardE | 10:bfa1c307c99d | 5 | * Makes objects descended from EnemyObject. |
RichardE | 10:bfa1c307c99d | 6 | * It is absolutely vital that all enemies are created and deleted this way if memory leaks are to be avoided. |
RichardE | 10:bfa1c307c99d | 7 | * Don't forget pesky enemies like MutantObjects that only appear half way through a level. They still need |
RichardE | 10:bfa1c307c99d | 8 | * to be created this way. |
RichardE | 10:bfa1c307c99d | 9 | * |
RichardE | 10:bfa1c307c99d | 10 | */ |
RichardE | 10:bfa1c307c99d | 11 | |
RichardE | 10:bfa1c307c99d | 12 | #ifndef EnemyFactoryDefined |
RichardE | 10:bfa1c307c99d | 13 | |
RichardE | 10:bfa1c307c99d | 14 | #define EnemyFactoryDefined |
RichardE | 10:bfa1c307c99d | 15 | |
RichardE | 10:bfa1c307c99d | 16 | #include "EnemyType.h" |
RichardE | 10:bfa1c307c99d | 17 | #include "GameObject.h" |
RichardE | 10:bfa1c307c99d | 18 | #include "HumanObject.h" |
RichardE | 10:bfa1c307c99d | 19 | #include "GruntObject.h" |
RichardE | 10:bfa1c307c99d | 20 | #include "CrusherObject.h" |
RichardE | 10:bfa1c307c99d | 21 | #include "BrainObject.h" |
RichardE | 10:bfa1c307c99d | 22 | #include "MutantObject.h" |
RichardE | 10:bfa1c307c99d | 23 | #include "BlueMeanyObject.h" |
RichardE | 10:bfa1c307c99d | 24 | |
RichardE | 10:bfa1c307c99d | 25 | class EnemyFactory { |
RichardE | 10:bfa1c307c99d | 26 | |
RichardE | 10:bfa1c307c99d | 27 | public : |
RichardE | 10:bfa1c307c99d | 28 | |
RichardE | 10:bfa1c307c99d | 29 | // An instance of this class. |
RichardE | 10:bfa1c307c99d | 30 | static EnemyFactory Instance; |
RichardE | 10:bfa1c307c99d | 31 | |
RichardE | 10:bfa1c307c99d | 32 | /***************/ |
RichardE | 10:bfa1c307c99d | 33 | /* CONSTRUCTOR */ |
RichardE | 10:bfa1c307c99d | 34 | /***************/ |
RichardE | 10:bfa1c307c99d | 35 | EnemyFactory(); |
RichardE | 10:bfa1c307c99d | 36 | |
RichardE | 10:bfa1c307c99d | 37 | /**************/ |
RichardE | 10:bfa1c307c99d | 38 | /* DESTRUCTOR */ |
RichardE | 10:bfa1c307c99d | 39 | /**************/ |
RichardE | 10:bfa1c307c99d | 40 | virtual ~EnemyFactory(); |
RichardE | 10:bfa1c307c99d | 41 | |
RichardE | 10:bfa1c307c99d | 42 | /*****************/ |
RichardE | 10:bfa1c307c99d | 43 | /* MAKE AN ENEMY */ |
RichardE | 10:bfa1c307c99d | 44 | /*****************/ |
RichardE | 10:bfa1c307c99d | 45 | // Pass enemy type in et. |
RichardE | 10:bfa1c307c99d | 46 | // Returns a newly created object or NULL on failure. |
RichardE | 10:bfa1c307c99d | 47 | EnemyObject* MakeEnemy( EnemyType et ); |
RichardE | 10:bfa1c307c99d | 48 | |
RichardE | 10:bfa1c307c99d | 49 | /*******************/ |
RichardE | 10:bfa1c307c99d | 50 | /* DELETE AN ENEMY */ |
RichardE | 10:bfa1c307c99d | 51 | /*******************/ |
RichardE | 10:bfa1c307c99d | 52 | // Pass pointer to enemy to delete. |
RichardE | 10:bfa1c307c99d | 53 | // ONLY USE THIS ON OBJECTS CREATED USING MakeEnemy method. |
RichardE | 10:bfa1c307c99d | 54 | void DeleteEnemy( EnemyObject *enemy ); |
RichardE | 10:bfa1c307c99d | 55 | |
RichardE | 10:bfa1c307c99d | 56 | private : |
RichardE | 10:bfa1c307c99d | 57 | |
RichardE | 10:bfa1c307c99d | 58 | // Number of enemies created. |
RichardE | 10:bfa1c307c99d | 59 | unsigned long enemyCount; |
RichardE | 10:bfa1c307c99d | 60 | |
RichardE | 10:bfa1c307c99d | 61 | }; |
RichardE | 10:bfa1c307c99d | 62 | |
RichardE | 10:bfa1c307c99d | 63 | #endif |
RichardE | 10:bfa1c307c99d | 64 | |
RichardE | 10:bfa1c307c99d | 65 | /* END of EnemyFactory.h */ |
RichardE | 10:bfa1c307c99d | 66 | |
RichardE | 10:bfa1c307c99d | 67 |