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

Committer:
RichardE
Date:
2013-06-17
Revision:
18:70190f956a24
Parent:
7:e72691603fd3

File content as of revision 18:70190f956a24:

/*
 * 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;
}