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
EnemyObject.cpp@18:70190f956a24, 2013-06-17 (annotated)
- Committer:
- RichardE
- Date:
- Mon Jun 17 15:10:43 2013 +0000
- Revision:
- 18:70190f956a24
- Parent:
- 7:e72691603fd3
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 | 7:e72691603fd3 | 1 | /* |
RichardE | 7:e72691603fd3 | 2 | * SOURCE FILE : EnemyObject.cpp |
RichardE | 7:e72691603fd3 | 3 | * |
RichardE | 7:e72691603fd3 | 4 | * Base class for enemy objects. |
RichardE | 7:e72691603fd3 | 5 | * |
RichardE | 7:e72691603fd3 | 6 | */ |
RichardE | 7:e72691603fd3 | 7 | |
RichardE | 7:e72691603fd3 | 8 | #include "EnemyObject.h" |
RichardE | 7:e72691603fd3 | 9 | |
RichardE | 7:e72691603fd3 | 10 | // Default object to chase. |
RichardE | 7:e72691603fd3 | 11 | PlayerObject EnemyObject::defaultChaseObject; |
RichardE | 7:e72691603fd3 | 12 | |
RichardE | 7:e72691603fd3 | 13 | /*****************************************************/ |
RichardE | 7:e72691603fd3 | 14 | /* CHECK IF ALL SURVIVING ENEMIES ARE INDESTRUCTABLE */ |
RichardE | 7:e72691603fd3 | 15 | /*****************************************************/ |
RichardE | 7:e72691603fd3 | 16 | // Pass pointer to array of pointers to EnemyObjects in enemies. |
RichardE | 7:e72691603fd3 | 17 | // Pass number of pointers in the array in enemyCount. |
RichardE | 7:e72691603fd3 | 18 | bool EnemyObject::AreAllIndestructable( const EnemyObject **enemies, UInt8 enemyCount ) { |
RichardE | 7:e72691603fd3 | 19 | const EnemyObject *enemy; |
RichardE | 7:e72691603fd3 | 20 | bool foundMortal = false; |
RichardE | 7:e72691603fd3 | 21 | UInt8 i = 0; |
RichardE | 7:e72691603fd3 | 22 | while( ! foundMortal && ( i < enemyCount ) ) { |
RichardE | 7:e72691603fd3 | 23 | enemy = enemies[ i ]; |
RichardE | 7:e72691603fd3 | 24 | if( ( enemy != (EnemyObject*)NULL ) && ( enemy->HitPoints != Indestructable ) ) { |
RichardE | 7:e72691603fd3 | 25 | foundMortal = true; |
RichardE | 7:e72691603fd3 | 26 | } |
RichardE | 7:e72691603fd3 | 27 | i++; |
RichardE | 7:e72691603fd3 | 28 | } |
RichardE | 7:e72691603fd3 | 29 | return ! foundMortal; |
RichardE | 7:e72691603fd3 | 30 | } |