Game For ECE 2035

Dependencies:   mbed wave_player 4DGL-uLCD-SE MMA8452

Revision:
7:862062ffca62
Parent:
6:c9695079521d
Child:
8:fcc333a8f9e1
--- a/main.cpp	Fri Nov 19 22:03:25 2021 +0000
+++ b/main.cpp	Sat Nov 20 03:37:50 2021 +0000
@@ -139,10 +139,28 @@
             MapItem* east = get_east(Player.x,Player.y);
             MapItem* curr =  get_here(Player.x,Player.y);
             
-            if(east||west||north||south->type == NPC){
+            if((east->type == NPC||west->type == NPC||north->type == NPC||south->type == NPC)&& Player.has_key == 1){
+                npc_speech2();
+                }
+                
+            if(east->type == NPC||west->type == NPC||north->type == NPC||south->type == NPC){
                 npc_speech1();
                 }
             
+            if(north->type == PORTAL||south->type == PORTAL||east->type == PORTAL||west->type == PORTAL){
+                init_dung();
+                Player.x = Player.y = 7;
+                }
+                
+            if((north->type == DRAGON||south->type == DRAGON||east->type == DRAGON||west->type == DRAGON )&& Player.spell == WATER){
+                slay_dragon();
+                Player.has_key = 1;
+                }
+                
+            if(north->type == PORTAl||south->type == PORTAl||east->type == PORTAl||west->type == PORTAl){
+                init_main_map();
+                }
+            
         }
         break;
         case MENU_BUTTON: {
@@ -241,19 +259,28 @@
     add_wall(0,              0,              VERTICAL,   map_height());
     add_wall(map_width()-1,  0,              VERTICAL,   map_height());
     pc.printf("Walls done!\r\n");
-
+    
+    
+    
+    for(int i = 7; i < 13;i++)
+    {
+        for (int j = 23; j <31;j++)
+        {
+            add_kindom(j,i);
+    }
+    }
+    
     add_npc(9,9);
 
-    add_chest(10,10);
+    //add_chest(10,10);
 
-    add_castle(15,15);
-
-    add_portal(25,30);
+    add_door(26,12);
+    
+    add_portal(20,35);
 
     print_map();
 }
 
-//void init_dung
 
 /**
  * Program entry point! This is where it all begins.
@@ -263,6 +290,11 @@
  */
 int main()
 {
+    
+    
+   // MapItem* north = get_north(Player.x,Player.y);
+    
+    
     // First things first: initialize hardware
     ASSERT_P(hardware_init() == ERROR_NONE, "Hardware init failed!");
 
@@ -299,5 +331,6 @@
         if (dt < 100) wait_ms(100 - dt);
     }
     //
+    
 
 }