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
Diff: EnemyObject.cpp
- Revision:
- 7:e72691603fd3
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/EnemyObject.cpp Sat Jun 08 16:44:54 2013 +0000 @@ -0,0 +1,30 @@ +/* + * SOURCE FILE : EnemyObject.cpp + * + * Base class for enemy objects. + * + */ + +#include "EnemyObject.h" + +// Default object to chase. +PlayerObject EnemyObject::defaultChaseObject; + +/*****************************************************/ +/* CHECK IF ALL SURVIVING ENEMIES ARE INDESTRUCTABLE */ +/*****************************************************/ +// Pass pointer to array of pointers to EnemyObjects in enemies. +// Pass number of pointers in the array in enemyCount. +bool EnemyObject::AreAllIndestructable( const EnemyObject **enemies, UInt8 enemyCount ) { + const EnemyObject *enemy; + bool foundMortal = false; + UInt8 i = 0; + while( ! foundMortal && ( i < enemyCount ) ) { + enemy = enemies[ i ]; + if( ( enemy != (EnemyObject*)NULL ) && ( enemy->HitPoints != Indestructable ) ) { + foundMortal = true; + } + i++; + } + return ! foundMortal; +}