![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Balint Bogdan SnekGame
Dependencies: FoodLibrary Gamepad N5110 SnekGame mbed
Diff: main.cpp
- Revision:
- 2:94b01aafb32f
- Parent:
- 1:a222ad7a05b9
--- a/main.cpp Fri May 05 11:56:20 2017 +0000 +++ b/main.cpp Fri May 05 15:22:29 2017 +0000 @@ -21,9 +21,6 @@ /************************Prototypes************************/ void start_screen(); -void init(); -void display(); -void update_game(UserInput input); /************************Variables************************/ @@ -38,53 +35,33 @@ lcd.init();//initializing display pad.init(); //pc.printf("initalized"); - snake.init(25,25,6); + snake.init(25,25,5,3); start_screen(); while (true) { - //run game engine - //implement safety features - //start stop buttons here for menu - - pad.leds_on(); - wait(0.05f); - pad.leds_off(); - wait(0.1f); - //engine.getInput(pad); - //snake.update(pad); + //printf("updated"); snake.draw(lcd); snake.update(pad); - //wait(0.2f); + } } /************************Functions************************/ void start_screen(){ + lcd.printString("Snek, the game",0,1); lcd.printString("Press Start",0,4); lcd.refresh(); printf("waiting for input"); - while ( pad.check_event(Gamepad::START_PRESSED) == false) {//this is a placeholder code from pong, change it please - pad.leds_on(); - wait(0.1); - pad.leds_off(); - wait(0.1); - printf("still..."); + while ( pad.check_event(Gamepad::START_PRESSED) == false) {//This switch code was taken from Pong, as it is a very simple code I left it here + + pad.leds_on(); + wait(0.1); + pad.leds_off(); + wait(0.1); + printf("still..."); + } printf("done"); - } - -void init(){ - - lcd.init();//initalizing display - pad.init();//inita;izing pad - - //bman.init();//initalizing game - } - -void display() { - - lcd.clear(); - //bman.display(lcd); - lcd.refresh(); -} \ No newline at end of file +} + \ No newline at end of file