Final Submission. I have read and agreed with Statement of Academic Integrity.
Dependencies: mbed Gamepad N5110 Joystick
Diff: main.cpp
- Revision:
- 2:0bd6711eae26
- Parent:
- 1:b9f3b7d869d8
- Child:
- 3:660de4311976
diff -r b9f3b7d869d8 -r 0bd6711eae26 main.cpp --- a/main.cpp Wed May 08 19:32:05 2019 +0000 +++ b/main.cpp Wed May 08 21:26:27 2019 +0000 @@ -20,17 +20,19 @@ Gamepad gamepad; // Instances -Snake snake; GameEngine engine; int main() { Init(); Welcome(); + engine.init(); while(1) { render(); + engine.get_dir(gamepad); + engine.snake_move(); } } @@ -49,8 +51,7 @@ gamepad.check_event(Gamepad::L_PRESSED); gamepad.check_event(Gamepad::R_PRESSED); gamepad.check_event(Gamepad::BACK_PRESSED); - gamepad.check_event(Gamepad::START_PRESSED); - snake.init(); + gamepad.check_event(Gamepad::START_PRESSED); } // Prototype welcome screen @@ -64,7 +65,7 @@ // Draws each frame on screen void render() { lcd.clear(); - engine.draw(lcd); - snake.draw_head(lcd); + engine.draw(lcd); lcd.refresh(); + wait(1.0); } \ No newline at end of file