![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Balint Bogdan SnekGame
Dependencies: FoodLibrary Gamepad N5110 SnekGame mbed
Revision 2:94b01aafb32f, committed 2017-05-05
- Comitter:
- Nefos
- Date:
- Fri May 05 15:22:29 2017 +0000
- Parent:
- 1:a222ad7a05b9
- Commit message:
- Handed in final version
Changed in this revision
--- a/Food.lib Fri May 05 11:56:20 2017 +0000 +++ b/Food.lib Fri May 05 15:22:29 2017 +0000 @@ -1,1 +1,1 @@ -Food#337503f9282c +https://developer.mbed.org/teams/ELEC2645-201617/code/FoodLibrary/#8d4639c9d1b0
--- a/Snake.lib Fri May 05 11:56:20 2017 +0000 +++ b/Snake.lib Fri May 05 15:22:29 2017 +0000 @@ -1,1 +1,1 @@ -Snake#5e04e34a3b66 +https://developer.mbed.org/teams/ELEC2645-201617/code/SnekGame/#a2f426a37e60
--- 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