![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 15:c4de6874aa19
- Parent:
- 14:d8ced73dbb83
- Child:
- 16:b0c0b1fc65d6
--- a/main.cpp Sun Mar 31 19:07:25 2019 +0000 +++ b/main.cpp Mon Apr 01 12:00:48 2019 +0000 @@ -9,6 +9,7 @@ Gamepad pad; Runner runner; Animation ani; +Levels lev; Ticker ticker; @@ -26,9 +27,11 @@ lcd.init(); lcd.setContrast(0.5); Move move; - + Pos pos; + move = runner.init(move); - + pos = lev.init(pos); + ticker.attach(&timer_isr,1.0f/fps); @@ -44,7 +47,7 @@ move = runner.nextLevel(move); //must happen befofre 'fall' otherwise runner can fall out of screen - runner.whatLevel(move, lcd); + pos = runner.whatLevel(move, lcd, pos); move = runner.buttonPress(move, lcd, pad); @@ -62,12 +65,12 @@ move = runner.runnerState(move, lcd, speed); //what state runner is in (must come after next level - runner.whatLevel(move, lcd); // call level + pos = runner.whatLevel(move, lcd, pos); // call level(why again)?? char buffer[14]; - sprintf(buffer,"%i",move.cr); + sprintf(buffer,"%i",pos.d); lcd.printString(buffer,0,1); //sleep(); //sleep untill next refresh