ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
45:bad704c546d4
Parent:
44:e29458976114
Child:
49:9bea7089b657
diff -r e29458976114 -r bad704c546d4 Levels/Levels.cpp
--- a/Levels/Levels.cpp	Wed Apr 17 19:57:33 2019 +0000
+++ b/Levels/Levels.cpp	Wed Apr 24 13:17:58 2019 +0000
@@ -7,7 +7,9 @@
 Levels::~Levels()
 {
 }
+/////////////////level 1 objects /////////////////////////
 
+// Generates all standard platforms for level 1
 void Levels::level_platforms1(N5110 &lcd)
 {
     lcd.drawLine(0,47,83,47, 1);
@@ -22,6 +24,7 @@
     lcd.drawRect(53,9,32,2,FILL_BLACK);
 }
 
+// sets positions of all traps level 1
 void Levels::trap_pos1()
 {
     trap1.tx[0] = 25;
@@ -36,6 +39,7 @@
     trap5.ty[0] = 36;
 }
 
+// sets all key positions for keys
 void Levels::key_pos1()
 {
     key1.kx[0] = 79;
@@ -50,6 +54,7 @@
     key5.ky[0] = 0;
 }
 
+// sets all block positions for level 1
 void Levels::block_pos1()
 {
     sol1.bx[0] = 49;
@@ -68,13 +73,14 @@
     sol5.by[0] = -10;
 }
 
+// sets all sinking block positions for level 1
 void Levels::soft_pos1()
 {    
     sof1.sx1[0] = 55;
     sof1.sy[0] = 36;
     sof1.sx2[0] = 65;
     
-    sof2.sx1[0] = 28;
+    sof2.sx1[0] = 27;
     sof2.sy[0] = 9;
     sof2.sx2[0] = 39;
     
@@ -86,11 +92,12 @@
     sof4.sy[0] = 0;
     sof4.sx2[0] = 0;
     
-    sof4.sx1[0] = 0;
-    sof4.sy[0] = 0;
-    sof4.sx2[0] = 0;
+    sof5.sx1[0] = 0;
+    sof5.sy[0] = 0;
+    sof5.sx2[0] = 0;
 }
 
+// sets all enemy positions for level 1
 void Levels::enem_pos1()
 {
     enem1.ex[0] = 22;
@@ -109,21 +116,9 @@
     enem3.v[0] = 1;
 }
 
-void Levels::level_exits(N5110 &lcd)
-{   
-    exit1.lx[0] = 78;
-    exit1.ly[0] = 41;
-    
-    exit1.lx[1] = 79;
-    exit1.ly[1] = 41;
-    
-    exit1.lx[2] = 70;
-    exit1.ly[2] = 41;
-    
-    exit1.lx[3] = 70;
-    exit1.ly[3] = 41;
-}
+/////////////////level 2 objects /////////////////////////
 
+// platform positions for level 2
 void Levels::level_platforms2(N5110 &lcd)
 {
     lcd.drawLine(0, 47, 83, 47, 1);
@@ -135,8 +130,9 @@
     lcd.drawRect(0, 10, 49, 2, FILL_BLACK);
     lcd.drawRect(54, 14, 12, 2, FILL_BLACK);
     lcd.drawRect(66, 8, 12, 2, FILL_BLACK);
-    
 }
+
+// key positions for level 2
 void Levels::key_pos2()
 {
     key1.kx[1] = 51;
@@ -155,6 +151,7 @@
     key5.ky[1] = 5;
 }
 
+// trap positions for level 2
 void Levels::trap_pos2()
 {
     trap1.tx[1] = 30;
@@ -173,6 +170,7 @@
     trap5.ty[1] = 69;
 }
 
+// enemy positions for level 2
 void Levels::enem_pos2()
 {
     enem1.ex[1] = 20;
@@ -191,6 +189,7 @@
     enem3.v[1] = 1;
 }
 
+// block positions for level 2
 void Levels::block_pos2()
 {
     sol1.bx[1] = 66;
@@ -209,6 +208,7 @@
     sol5.by[1] = 14;
 }
 
+// sinking block positions for level 2
 void Levels::soft_pos2()
 {
     sof1.sx1[1] = 72;
@@ -232,6 +232,7 @@
     sof5.sx2[1] = 84;
 }
 
+// platform positions for level 3
 void Levels::level_platforms3(N5110 &lcd)
 {
     lcd.drawLine(0, 47, 83, 47, 1);
@@ -242,6 +243,10 @@
     lcd.drawRect(54, 30, 10, 2, FILL_BLACK);
     
 }
+
+/////////////////level 3 objects /////////////////////////
+
+// key positions for level 3
 void Levels::key_pos3()
 {
     key1.kx[2] = 38;
@@ -260,6 +265,7 @@
     key5.ky[2] = 23;
 }
 
+// trap positions for level 3
 void Levels::trap_pos3()
 {
     trap1.tx[2] = 54;
@@ -278,6 +284,7 @@
     trap5.ty[2] = 7;
 }
 
+// enemy positions for level 3
 void Levels::enem_pos3()
 {
     enem1.ex[2] = 49;
@@ -296,6 +303,7 @@
     enem3.v[2] = 1;
 }
 
+// block positions for level 3
 void Levels::block_pos3()
 {
     sol1.bx[2] = 15;
@@ -314,6 +322,7 @@
     sol5.by[2] = 16;
 }
 
+// sinking block positions for level 3
 void Levels::soft_pos3()
 {
     sof1.sx1[2] = 12;
@@ -337,3 +346,18 @@
     sof5.sx2[2] = 0;
 }
 
+// exit positions for all levels
+void Levels::level_exits(N5110 &lcd)
+{   
+    exit1.lx[0] = 78;
+    exit1.ly[0] = 41;
+    
+    exit1.lx[1] = 79;
+    exit1.ly[1] = 41;
+    
+    exit1.lx[2] = 70;
+    exit1.ly[2] = 41;
+    
+    exit1.lx[3] = 70;
+    exit1.ly[3] = 41;
+}
\ No newline at end of file