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
LevelDescriptor.h@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 12:81926431fea7
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 : LevelDescriptor.h |
RichardE | 10:bfa1c307c99d | 3 | * |
RichardE | 10:bfa1c307c99d | 4 | * Definition of class LevelDescriptor. |
RichardE | 10:bfa1c307c99d | 5 | * Describes a level. |
RichardE | 10:bfa1c307c99d | 6 | * |
RichardE | 10:bfa1c307c99d | 7 | */ |
RichardE | 10:bfa1c307c99d | 8 | |
RichardE | 10:bfa1c307c99d | 9 | #ifndef LevelDescriptorDefined |
RichardE | 10:bfa1c307c99d | 10 | |
RichardE | 10:bfa1c307c99d | 11 | #define LevelDescriptorDefined |
RichardE | 10:bfa1c307c99d | 12 | |
RichardE | 10:bfa1c307c99d | 13 | #include "Types.h" |
RichardE | 10:bfa1c307c99d | 14 | #include "EnemyType.h" |
RichardE | 10:bfa1c307c99d | 15 | |
RichardE | 10:bfa1c307c99d | 16 | class LevelDescriptor { |
RichardE | 10:bfa1c307c99d | 17 | |
RichardE | 10:bfa1c307c99d | 18 | public : |
RichardE | 10:bfa1c307c99d | 19 | |
RichardE | 12:81926431fea7 | 20 | // Number of humans. |
RichardE | 12:81926431fea7 | 21 | UInt8 HumanCount; |
RichardE | 12:81926431fea7 | 22 | |
RichardE | 12:81926431fea7 | 23 | // Array containing enemy data. |
RichardE | 12:81926431fea7 | 24 | // The array alternates between enemy type and count and MUST |
RichardE | 12:81926431fea7 | 25 | // be terminated with a byte of value ENDDESCRIPTOR. |
RichardE | 12:81926431fea7 | 26 | const UInt8* EnemyData; |
RichardE | 12:81926431fea7 | 27 | |
RichardE | 12:81926431fea7 | 28 | /***************/ |
RichardE | 12:81926431fea7 | 29 | /* CONSTRUCTOR */ |
RichardE | 12:81926431fea7 | 30 | /***************/ |
RichardE | 12:81926431fea7 | 31 | // Pass number of humans on level in hc. |
RichardE | 12:81926431fea7 | 32 | // Pass array of data defining enemies in ed. |
RichardE | 12:81926431fea7 | 33 | // The array alternates between enemy type and count and MUST |
RichardE | 12:81926431fea7 | 34 | // be terminated with a byte of value ENDDESCRIPTOR. |
RichardE | 12:81926431fea7 | 35 | LevelDescriptor( UInt8 hc, const UInt8 *ed ) { |
RichardE | 12:81926431fea7 | 36 | HumanCount = hc; |
RichardE | 12:81926431fea7 | 37 | EnemyData = ed; |
RichardE | 12:81926431fea7 | 38 | } |
RichardE | 12:81926431fea7 | 39 | |
RichardE | 12:81926431fea7 | 40 | /**************/ |
RichardE | 12:81926431fea7 | 41 | /* DESTRUCTOR */ |
RichardE | 12:81926431fea7 | 42 | /**************/ |
RichardE | 12:81926431fea7 | 43 | virtual ~LevelDescriptor() { |
RichardE | 12:81926431fea7 | 44 | } |
RichardE | 12:81926431fea7 | 45 | |
RichardE | 10:bfa1c307c99d | 46 | // Used to mark the end of the descriptor array. |
RichardE | 10:bfa1c307c99d | 47 | #define ENDDESCRIPTOR ((UInt8)0xFF) |
RichardE | 10:bfa1c307c99d | 48 | |
RichardE | 10:bfa1c307c99d | 49 | /*****************************************/ |
RichardE | 10:bfa1c307c99d | 50 | /* GET COUNT FOR A PARTICULAR ENEMY TYPE */ |
RichardE | 10:bfa1c307c99d | 51 | /*****************************************/ |
RichardE | 10:bfa1c307c99d | 52 | // Pass type of enemy to fetch count for in et. |
RichardE | 10:bfa1c307c99d | 53 | // Returns number of enemies of the given type on this level. |
RichardE | 12:81926431fea7 | 54 | UInt8 GetEnemyCount( EnemyType et ) const; |
RichardE | 10:bfa1c307c99d | 55 | |
RichardE | 10:bfa1c307c99d | 56 | private : |
RichardE | 10:bfa1c307c99d | 57 | |
RichardE | 10:bfa1c307c99d | 58 | }; |
RichardE | 10:bfa1c307c99d | 59 | |
RichardE | 10:bfa1c307c99d | 60 | #endif |
RichardE | 10:bfa1c307c99d | 61 | |
RichardE | 10:bfa1c307c99d | 62 | /* END of LevelDescriptor.h */ |
RichardE | 10:bfa1c307c99d | 63 | |
RichardE | 10:bfa1c307c99d | 64 |