![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Adam Baker 201166301
Dependencies: mbed Gamepad N5110
Diff: main.cpp
- Revision:
- 6:cef9c2853315
- Parent:
- 5:37b37f48e8bf
- Child:
- 7:66ea4d394fea
diff -r 37b37f48e8bf -r cef9c2853315 main.cpp --- a/main.cpp Thu Mar 21 17:55:37 2019 +0000 +++ b/main.cpp Fri Mar 22 18:07:39 2019 +0000 @@ -2,11 +2,14 @@ #include "Gamepad.h" #include "N5110.h" #include "Runner.h" +#include "Levels.h" + N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); Gamepad pad; Runner runner; + int main() { int fps = 12; @@ -21,14 +24,11 @@ while(1) { lcd.clear(); - - lcd.drawLine(0,40,84,40,1); - lcd.drawLine(20,20,20,30,1); - lcd.drawLine(40,30,40,10,1); - //lcd.drawLine(40,30,40,40,1); - lcd.drawCircle(move.x,move.y,3,FILL_BLACK); + + move = runner.nextLevel(move, lcd); //must happen befofre 'fall' otherwise runner can fall out of screen + float speed = runner.getSpeed(pad); @@ -43,15 +43,19 @@ move = runner.runLeft(move, lcd, speed); move = runner.runRight(move, lcd, speed); + + move = runner.fall(move, lcd); - /**char buffer[14]; - sprintf(buffer,"x = %i",move.j); + + + char buffer[14]; + sprintf(buffer,"%i",move.wjl); lcd.printString(buffer,0,1); - */ + char buffer1[14]; - sprintf(buffer1,"w = %i",move.wjl); + sprintf(buffer1,"%i",move.wjr); lcd.printString(buffer1,0,0);