![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Owen Cavender 201159294
Diff: main.cpp
- Revision:
- 10:ee781d18e0f6
- Parent:
- 9:a69a6a06dddf
- Child:
- 11:e7c56013acd9
- Child:
- 12:60c856354406
--- a/main.cpp Thu May 28 19:16:52 2020 +0000 +++ b/main.cpp Thu May 28 20:58:49 2020 +0000 @@ -43,7 +43,7 @@ int main() { - printf("hello world"); + int fps = 6; // frames per second init(); // initialise and then display welcome screen... @@ -56,7 +56,8 @@ while (1) { snake.get_direction(pad); - snake.render_clear_tail(lcd); // =needs to be cleared before _x3, _y3 is updated + snake.render_clear_tail(lcd); + engine.get_LEDs(pad, snake); // =needs to be cleared before _x3, _y3 is updated snake.move_snake(); snake.check_collisions(); @@ -68,7 +69,7 @@ gameover_true(); snake.render(lcd); - engine.print_display_time(lcd); + snake.print_display_time(lcd); wait(1.0f/fps); @@ -76,7 +77,7 @@ } - +//added old score - changed postion of timer and code void init() { @@ -91,7 +92,7 @@ void welcome() { - printf("hello world"); + lcd.printString(" SNAKE ",0,1); lcd.printString(" Press Start ",0,4); @@ -125,7 +126,6 @@ while (gameover == true) { lcd.clear(); - lcd.refresh(); lcd.printString( " Game Over L ", 0, 2 ); engine.print_scores(lcd, snake); @@ -138,11 +138,11 @@ lcd.printString(" SNAKE PRO ", 0,10); lcd.printString(" ~.~.~.~.<8>~ ", 0, 5); } - } - - + wait(3); + + lcd.refresh(); } - +} //has an apple been collected? if so increase length by 1 increase score by 1 and makes coin collecting noise and spawn new apple //has snake touched itself or wall - if so end game - present score - make xxx sound fail --- apple needs to be different to the snakes body and different to wall