Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: main.cpp
- Revision:
- 8:32825d724856
- Parent:
- 7:9bd49beccdd1
- Child:
- 9:25597bc0cecc
--- a/main.cpp	Thu Jun 04 21:04:55 2020 +0000
+++ b/main.cpp	Fri Jun 05 06:29:17 2020 +0000
@@ -16,8 +16,13 @@
 #include "N5110.h"
 #include "Bitmap.h"
 #include "SnakeEngine.h"
+#include "Snake.h"
+#include "Apple.h"
 
-#define SCORE 2
+#define SCORE 6
+#define APPLE_SIZE 3
+#define SNAKE_SPEED 1
+
 
 
 /////////////// structs /////////////////
@@ -30,6 +35,7 @@
 Gamepad pad;
 SnakeEngine snake;
 
+
 ///////////// prototypes ///////////////
 void init();
 void update_game(UserInput input);
@@ -40,7 +46,6 @@
 int main()
 {
 
-
     int fps = 6;  // frames per second
 
     init();     // initialise and then display welcome screen...
@@ -65,9 +70,6 @@
     // need to initialise LCD and Gamepad 
     lcd.init();
     pad.init();
-     
-
-
 }
 
 // this function draws each frame on the LCD
@@ -82,10 +84,16 @@
 // simple splash screen displayed on start-up
 void welcome() {
     pad.led(3,1);  // Only Show Green LEDS
-    pad.led(6,1);  //
-            
-       // main menu screen no interaction yet pressing start won't do anything but its a start if you pardon the pun!     
+    pad.led(6,1);  //       
     lcd.clear();
+       lcd.clear(); // we need to clear the screen first
+   lcd.printString("    Author   ",0,1);  
+   lcd.printString("Simon Atkinson",0,2); 
+   lcd.printString("   201255483  ",0,3); 
+   lcd.printString(" Uni of Leeds ",0,4); 
+   lcd.refresh(); // need to refresh display after setting pixels or writing strings
+           wait(1.0); // we don't want this screen on long!
+               lcd.clear();
     lcd.printString("  Welcome to  ",0,1);  
     lcd.printString("    Snake!   ",0,2); 
     lcd.printString("  Press Start ",0,4);