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

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers LevelDescriptor.cpp Source File

LevelDescriptor.cpp

00001 /*
00002  * SOURCE FILE : LevelDescriptor.cpp
00003  *
00004  * Definition of class LevelDescriptor.
00005  * Describes a level.
00006  *
00007  */
00008 
00009 #include "LevelDescriptor.h"
00010 
00011 /*****************************************/
00012 /* GET COUNT FOR A PARTICULAR ENEMY TYPE */
00013 /*****************************************/
00014 // Pass type of enemy to fetch count for in et.
00015 // Returns number of enemies of the given type on this level.
00016 UInt8 LevelDescriptor::GetEnemyCount( EnemyType et ) const {
00017     bool found = false;
00018     const UInt8 *data = EnemyData;
00019     while( ! found && ( *data != ENDDESCRIPTOR ) ) {
00020         if( *data == (UInt8)et ) {
00021             found = true;
00022         }
00023         else {
00024             data += 2;
00025         }
00026     }        
00027     if( found ) {
00028         return data[ 1 ];
00029     }
00030     else {
00031         return 0;
00032     }
00033 }
00034