A complex 2D-dungeon game on LPC1768 in SWJTU-Leeds Joint School XJEL2645 project. Referenced from the framework contributed by https://os.mbed.com/users/Siriagus/code/SimplePlatformGame/

Dependencies:   mbed N5110 ShiftReg PinDetect

Revision:
19:89c3eeb3761b
Parent:
17:d6a3b29cab31
--- a/Global.cpp	Mon May 11 04:40:23 2015 +0000
+++ b/Global.cpp	Thu Mar 25 03:43:10 2021 +0000
@@ -5,6 +5,7 @@
 namespace Global
 {
     int score = 0;
+    
     Highscore highscores[3] = {{"AAA", 0}, {"AAA", 0}, {"AAA", 0}};
     
     void clearHighscoreList()
@@ -24,4 +25,41 @@
             
         fclose(fp);
     }
+}
+
+/// Setup the enemy based on type
+void Enemy::setup()
+{   
+    switch (type)
+    {
+        case SIMPLE:
+            width = 5;
+            height = 5;
+            vx = 1;
+            difficulty = 1;
+            jumpRate = 3;
+        break;
+        
+        case JUMPER:
+            width = 3;
+            height = 4;
+            vx = 1;
+            difficulty = 3;
+            jumpRate = 50;
+        break;
+        
+        case RUNNER:
+            width = 6;
+            height = 5;
+            vx = 2;
+            difficulty = 5;
+            jumpRate = 0;
+        break;
+        
+        default: // error, should not be possible
+            width = height = vx = vy = 0;
+    }
+    
+    if (facingLeft)
+        vx *= -1;    
 }
\ No newline at end of file