Adam Baker 201166301

Dependencies:   mbed Gamepad N5110

Revision:
18:0a0976faedfb
Parent:
17:ecbafe932c19
Child:
19:48d49a42037c
--- a/main.cpp	Mon Apr 01 17:25:59 2019 +0000
+++ b/main.cpp	Tue Apr 02 18:13:09 2019 +0000
@@ -21,17 +21,18 @@
 int main()
 {
 
-    int fps = 6;
+    int fps = 6; //6
     int d = 0 ; // direction of moving plats
+    int d2 = 0;
     
     pad.init();
     lcd.init();
     lcd.setContrast(0.55);
     Move move;
-    //Pos pos;
+    Pos pos;
     
     move = runner.init(move);
-    //pos = lev.init(pos);
+    pos = lev.init(pos);
     
     ticker.attach(&timer_isr,1.0f/fps);
 
@@ -48,7 +49,7 @@
 
             move = runner.nextLevel(move); //must happen befofre 'fall' otherwise runner can fall out of screen
 
-            d = runner.whatLevel(move, lcd);
+            pos = lev.whatLevel(lcd, move.l);
 
             move = runner.buttonPress(move, lcd, pad);
 
@@ -68,14 +69,18 @@
 
             move = runner.runnerState(move, lcd, speed); //what state runner is in (must come after next level
 
-            d = runner.whatLevel(move, lcd); // call level(why again)??
-
-            move = runner.onPlatform(move, d);
+            //runner.whatLevel(move, lcd); // call level(why again)??
+            d = runner.onPlatformCheck(move, pos);
+            d2 = runner.onPlatform2Check(move, pos);
+            move = runner.onPlatform(lcd, move, d, d2);
 
 
             char buffer[14];
-            sprintf(buffer,"%i",d);
-            lcd.printString(buffer,0,1);
+            sprintf(buffer,"%i %i %i %i %i" ,pos.x, pos.y, pos.d, pos.c, pos.l);
+            lcd.printString(buffer,0,0);
+            char buffer1[14];
+            sprintf(buffer1,"%i %i %i",move.x, move.y, d);
+            lcd.printString(buffer1,0,1);
 
             //sleep(); //sleep untill next refresh