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

Revision:
10:bfa1c307c99d
Child:
12:81926431fea7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LevelDescriptor.cpp	Sun Jun 09 19:34:56 2013 +0000
@@ -0,0 +1,36 @@
+/*
+ * SOURCE FILE : LevelDescriptor.cpp
+ *
+ * Definition of class LevelDescriptor.
+ * Describes a level.
+ *
+ */
+
+#include "LevelDescriptor.h"
+
+/*****************************************/
+/* GET COUNT FOR A PARTICULAR ENEMY TYPE */
+/*****************************************/
+// Pass pointer to array containing data in data parameter.
+// The array alternates between enemy type and count and MUST
+// be terminated with a byte of value ENDDESCRIPTOR.
+// Pass type of enemy to fetch count for in et.
+// Returns number of enemies of the given type on this level.
+UInt8 LevelDescriptor::GetEnemyCount( const UInt8 *data, EnemyType et ) {
+    bool found = false;
+    while( ! found && ( *data != ENDDESCRIPTOR ) ) {
+        if( *data == (UInt8)et ) {
+            found = true;
+        }
+        else {
+            data += 2;
+        }
+    }        
+    if( found ) {
+        return data[ 1 ];
+    }
+    else {
+        return 0;
+    }
+}
+