Final Submission. I have read and agreed with Statement of Academic Integrity.
Dependencies: mbed Gamepad N5110 Joystick
Diff: main.cpp
- Revision:
- 4:0fc3441556e1
- Parent:
- 3:660de4311976
- Child:
- 5:23a85b16ee54
--- a/main.cpp Thu May 09 00:19:35 2019 +0000 +++ b/main.cpp Thu May 09 07:26:07 2019 +0000 @@ -13,6 +13,9 @@ #include "main.h" #include "Snake.h" #include "Game_engine.h" +#include <stdio.h> +#include <stdlib.h> +#include <time.h> // Gamepad Peripherals N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11); @@ -33,9 +36,7 @@ while(1) { render(); - engine.get_dir(gamepad); - engine.snake_move(); - engine.food_move(); + update(); } } @@ -70,5 +71,12 @@ lcd.clear(); engine.draw(lcd); lcd.refresh(); +} +void update() { + engine.get_dir(gamepad); + engine.snake_move(); + engine.food_move(); + engine.snake_body(lcd); + lcd.refresh(); wait(0.2); } \ No newline at end of file