Game For ECE 2035

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Revision:
13:798a4dd14c7e
Parent:
12:116a4cc85b16
Child:
14:7225da81314a
--- a/main.cpp	Thu Dec 02 16:58:38 2021 +0000
+++ b/main.cpp	Thu Dec 02 20:16:28 2021 +0000
@@ -168,16 +168,24 @@
                 Player.x = Player.y = 7;
             }
             
-            if((east->type == ENEMY||west->type == ENEMY||north->type == ENEMY||south->type == ENEMY)&& Player.spell == EARTH) {
-                map_delete(13,14);
+            if((east->type == ENEMY1||west->type == ENEMY1||north->type == ENEMY1||south->type == ENEMY1)&& Player.spell == EARTH) {
+                Player.spell = NULL;
+                map_delete(10,10);
             }
             
-            if((east->type == ENEMY||west->type == ENEMY||north->type == ENEMY||south->type == ENEMY)&& Player.spell == FIRE) {
+            if((east->type == ENEMY2||west->type == ENEMY2||north->type == ENEMY2||south->type == ENEMY2)&& Player.spell == FIRE) {
+                Player.spell = NULL;
                 Player.HP-=2;
-                map_delete(5,10);
+                map_delete(5,7);
             }
             
-            if((east->type == ENEMY||west->type == ENEMY||north->type == ENEMY||south->type == ENEMY)&& Player.spell == WATER) {
+            if((east->type == ENEMY1||west->type == ENEMY1||north->type == ENEMY1||south->type == ENEMY1) && Player.spell == NULL) {
+                Player.HP-=10;
+                Player.x--;
+                Player.y--;
+            }
+            
+            if((east->type == ENEMY2||west->type == ENEMY2||north->type == ENEMY2||south->type == ENEMY2) && Player.spell == NULL) {
                 Player.HP-=10;
                 Player.x--;
                 Player.y--;
@@ -187,7 +195,7 @@
             if((north->type == DRAGON||south->type == DRAGON||east->type == DRAGON||west->type == DRAGON )&& Player.spell == WATER) {
                 slay_dragon();
                 Player.has_key = 1;
-                walk_goblin(0);
+                //walk_goblin(0);
             }
 
             if(north->type == PORTAl||south->type == PORTAl||east->type == PORTAl||west->type == PORTAl) {
@@ -214,11 +222,12 @@
                     east->data = NULL;
                     west->data = NULL;
                     curr->data = NULL;
+                    wave_file = fopen("/sd/rupee-collect.wav","r");
+                waver.play(wave_file);
+                fclose(wave_file);
                 } else
                     no_fruit();
-                wave_file = fopen("/sd/rupee-collect.wav","r");
-                waver.play(wave_file);
-                fclose(wave_file);
+                
 
 
 
@@ -347,6 +356,7 @@
     
     add_npc2(30,30);
     
+    add_merch(12,16);
     
     add_door(26,12);