![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: main.cpp
- Revision:
- 62:ebf6ecf8a6d5
- Parent:
- 56:142e9fdb77a8
- Child:
- 63:205f0ca48473
diff -r f3c402bc2ad0 -r ebf6ecf8a6d5 main.cpp --- a/main.cpp Tue Apr 30 08:32:30 2019 +0000 +++ b/main.cpp Tue Apr 30 14:53:38 2019 +0000 @@ -50,17 +50,19 @@ _start.credits(lcd); // this is after the menu to allow us to hide credits if we want to play the game fast. fps = _start.fps; // sets the frames per second required, selected from the game speed menu. g_mode = _start.g_mode;// allows us to pass this information on to the snakevsblock class, to set the controls to either joystick or motion control. - // start the game + // start the game refresh_game(); - wait(1.0f/fps); - + wait(1.0f/fps); + // snakeVSblock - detect input respect to the menu options, and update data and refresh screen while (1) { - + game.read_input(pad, device, g_mode); //this reads the angle or joystick direction, on the condition of either of them being selected. - back = game.update(lcd, pad, sd); //the int back stores the value 1 if back is pressed inside the update function of snakevsblock - if(back) { break; } //and this allows us to return to main menu by using the keyword break. - + back = game.update(lcd, pad, sd); //the int back stores the value 1 if back is pressed inside the update function of snakevsblock + if(back) { + break; //and this allows us to return to main menu by using the keyword break. + } + refresh_game(); wait(1.0f/fps); } @@ -69,7 +71,7 @@ void init() { - // need to initialise LCD and Gamepad + // need to initialise LCD and Gamepad lcd.init(); //init for the N5110 Library. device.init(); //init for the FXOS8700CQ Library. pad.init(); //init for the Gamepad Library.