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

Committer:
RichardE
Date:
Mon Jun 10 20:02:28 2013 +0000
Revision:
12:81926431fea7
Parent:
10:bfa1c307c99d
Changed so you can specify how many humans you want on each level. Mainly messing around with LevelDescriptor and LevelCollection classes.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RichardE 10:bfa1c307c99d 1 /*
RichardE 10:bfa1c307c99d 2 * SOURCE FILE : LevelDescriptor.cpp
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 #include "LevelDescriptor.h"
RichardE 10:bfa1c307c99d 10
RichardE 10:bfa1c307c99d 11 /*****************************************/
RichardE 10:bfa1c307c99d 12 /* GET COUNT FOR A PARTICULAR ENEMY TYPE */
RichardE 10:bfa1c307c99d 13 /*****************************************/
RichardE 10:bfa1c307c99d 14 // Pass type of enemy to fetch count for in et.
RichardE 10:bfa1c307c99d 15 // Returns number of enemies of the given type on this level.
RichardE 12:81926431fea7 16 UInt8 LevelDescriptor::GetEnemyCount( EnemyType et ) const {
RichardE 10:bfa1c307c99d 17 bool found = false;
RichardE 12:81926431fea7 18 const UInt8 *data = EnemyData;
RichardE 10:bfa1c307c99d 19 while( ! found && ( *data != ENDDESCRIPTOR ) ) {
RichardE 10:bfa1c307c99d 20 if( *data == (UInt8)et ) {
RichardE 10:bfa1c307c99d 21 found = true;
RichardE 10:bfa1c307c99d 22 }
RichardE 10:bfa1c307c99d 23 else {
RichardE 10:bfa1c307c99d 24 data += 2;
RichardE 10:bfa1c307c99d 25 }
RichardE 10:bfa1c307c99d 26 }
RichardE 10:bfa1c307c99d 27 if( found ) {
RichardE 10:bfa1c307c99d 28 return data[ 1 ];
RichardE 10:bfa1c307c99d 29 }
RichardE 10:bfa1c307c99d 30 else {
RichardE 10:bfa1c307c99d 31 return 0;
RichardE 10:bfa1c307c99d 32 }
RichardE 10:bfa1c307c99d 33 }
RichardE 10:bfa1c307c99d 34