Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 3:d27ee2440829
- Parent:
- 2:725c213b2396
- Child:
- 4:b92da6a09c8b
--- a/main.cpp Wed Mar 20 01:32:31 2019 +0000 +++ b/main.cpp Wed Mar 20 18:32:25 2019 +0000 @@ -16,20 +16,20 @@ int main() { - lcd.clear(); init(); start_screen(); - lcd.refresh(); while (1) { contrast(); level.test_level(lcd); + engine.miner_gravity(lcd); + engine.miner_jump(lcd, pad); engine.read_direction(pad); - engine.miner_move(); + engine.miner_move(lcd, pad); engine.miner_draw(lcd); - engine.miner_jump(lcd, pad); - wait(0.1); + + wait(0.05); } @@ -43,6 +43,7 @@ lcd.refresh(); pad.init(); pad.leds_off(); + contrast(); } @@ -58,89 +59,15 @@ void start_screen() { - - lcd.printString("***MANIC MILNER!***",0,1); - lcd.printString(" Press start to play! ",0,4); - + + lcd.printString("*MANIC MILNER!*",0,1); + lcd.printString(" Press start! ",0,4); + lcd.refresh(); while ( pad.check_event(Gamepad::START_PRESSED) == false) { - contrast(); pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); - } -} - -/*void minermove() -{ - - const int miner_right[13][5] = { - 0,0,0,1,1, - 0,1,1,1,1, - 0,1,0,1,0, - 0,1,1,1,1, - 0,1,1,1,0, - 0,0,1,0,0, - 1,1,1,1,1, - 1,1,1,1,1, - 1,1,1,1,1, - 0,1,1,1,0, - 0,1,0,1,0, - 0,1,1,1,1, - }; - - const int miner_left[13][5] = { - 1,1,0,0,0, - 1,1,1,1,0, - 0,1,0,1,0, - 1,1,1,1,0, - 0,1,1,1,0, - 0,0,1,0,0, - 1,1,1,1,1, - 1,1,1,1,1, - 1,1,1,1,1, - 0,1,1,1,0, - 0,1,0,1,0, - 1,1,1,1,0, - }; - - lcd.drawSprite(WIDTH/2 + x_direction,HEIGHT/2 + y_direction,13,5,(int *)miner_right); - - Direction d = pad.get_direction(); - printf("Direction = %i\n",d); - - if (d==3) { - - x_direction = x_direction + 1; - lcd.clear(); - lcd.drawSprite(WIDTH/2 + x_direction,HEIGHT/2 + y_direction,13,5,(int *)miner_right); - lcd.refresh(); - wait(0.05); - - } - - if (d == 7) { - - x_direction = x_direction - 1; - lcd.clear(); - lcd.drawSprite(WIDTH/2 + x_direction,HEIGHT/2 + y_direction,13,5,(int *)miner_left); - lcd.refresh(); - wait(0.05); - } - //lcd.drawSprite(WIDTH/2 + x,HEIGHT/2 + y,13,5,(int *)miner); - //lcd.refresh(); - - if(pad.check_event(Gamepad::A_PRESSED)) { - - - printf("A pressed"); - y_direction = y_direction - 6; - lcd.clear(); - lcd.drawSprite(WIDTH/2 + x_direction,HEIGHT/2 + y_direction,13,5,(int *)miner_right); - lcd.refresh(); - wait(0.2); - y_direction = y_direction + 6; - } -}*/ \ No newline at end of file +} \ No newline at end of file