ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
18:ff0a53dcb862
Parent:
17:b4079bd0e551
Child:
19:4789cb4ca550
--- a/Levelengine.cpp	Mon Apr 01 14:59:18 2019 +0000
+++ b/Levelengine.cpp	Mon Apr 01 21:51:08 2019 +0000
@@ -13,29 +13,11 @@
 {
 }
 
-void Levelengine::level_one(N5110 &lcd)
-{
-    //platforms
-
-    lcd.drawRect(0,HEIGHT -1,84,1,FILL_BLACK);
-    lcd.drawRect(11,HEIGHT - 9, 38, 2, FILL_TRANSPARENT);
-    lcd.drawRect(65,HEIGHT - 11, 30, 2, FILL_TRANSPARENT);
-    lcd.drawRect(WIDTH - 9,HEIGHT - 19, 8, 2, FILL_BLACK);
-    lcd.drawRect(22, 25, 48, 2, FILL_BLACK);
-    lcd.drawRect(0, 25, 12, 2, FILL_BLACK);
-    lcd.drawRect(0, 17, 8, 2, FILL_BLACK);
-    lcd.drawRect(0, 9, 27, 2, FILL_BLACK);
-    lcd.drawRect(39, 9, 7, 2, FILL_BLACK);
-    lcd.drawRect(58,9,32,2,FILL_BLACK);
-
-}
-
 void Levelengine::soft_blocks(int x, int y, N5110 &lcd)
 {
     if((lcd.getPixel(x,y))||(lcd.getPixel(x+1,y))||(lcd.getPixel(x+2,y))
             ||(lcd.getPixel(x+3,y))||(lcd.getPixel(x+4,y))||(lcd.getPixel(x+5,8)) == 1) {
         lcd.drawRect(x,y+1,6,1,FILL_WHITE);
-        printf("pixel = %i \n", lcd.getPixel(x,y));
     } else {
         lcd.drawRect(x,y+1,6,1,FILL_BLACK);
     }
@@ -112,3 +94,47 @@
     int k = _keys;
     return k;
 }
+
+int Levelengine::spike1(int x, int y, N5110 &lcd)
+{
+    lcd.drawSprite(x,y,3,3,(int *)spike);
+
+    if (lcd.getPixel(x,y-1) || lcd.getPixel(x+2,y-1) == 1) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int Levelengine::spike2(int x, int y, N5110 &lcd)
+{
+    lcd.drawSprite(x,y,3,3,(int *)spike);
+
+    if (lcd.getPixel(x,y-1) || lcd.getPixel(x+2,y-1) == 1) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int Levelengine::spike3(int x, int y, N5110 &lcd)
+{
+    lcd.drawSprite(x,y,3,3,(int *)spike);
+
+    if (lcd.getPixel(x,y-1) || lcd.getPixel(x+2,y-1) == 1) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
+
+int Levelengine::spike4(int x, int y, N5110 &lcd)
+{
+    lcd.drawSprite(x,y,3,3,(int *)spike);
+
+    if (lcd.getPixel(x,y-1) || lcd.getPixel(x+2,y-1) == 1) {
+        return 1;
+    } else {
+        return 0;
+    }
+}
\ No newline at end of file