Ball drop game with menus and highscore tracking developed for ELEC2645 at the University of Leeds.

Dependencies:   N5110 mbed PowerControl

Game developed for ELEC 2645.

Extremely detailed report outlining all aspects of project found below. /media/uploads/AppleJuice/projectreport.pdf

Files at this revision

API Documentation at this revision

Comitter:
AppleJuice
Date:
Thu Apr 30 00:15:51 2015 +0000
Parent:
12:9ba4b21f8220
Child:
14:f5760f76fe83
Commit message:
highscore screen complete. All that is left to do is pause screen, sounds, csv management and power cuts!;

Changed in this revision

GameScreen.cpp Show annotated file Show diff for this revision Revisions of this file
GameScreen.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/GameScreen.cpp	Wed Apr 29 23:45:08 2015 +0000
+++ b/GameScreen.cpp	Thu Apr 30 00:15:51 2015 +0000
@@ -309,3 +309,27 @@
     
 }
 
+void GameScreen::displayHighScores(char **initials,int * lvls)
+{
+    clear();
+    printString("SCORES",maxX_ - 2,-1);
+
+
+    char buffer[10];
+    
+    sprintf(buffer,"1.%s %d",initials[0],lvls[0]);
+    printString(buffer,maxX_ - 2,15);
+
+    sprintf(buffer,"2.%s %d",initials[1],lvls[1]);    
+    printString(buffer,maxX_ - 2,33);
+    
+    sprintf(buffer,"3.%s %d",initials[2],lvls[2]);  
+    printString(buffer,maxX_ - 2,51);
+    
+    
+    printString("Click",maxX_ - 2,68);
+    printString("to quit!",maxX_ - 2,76);
+    refresh();
+ 
+}
+
--- a/GameScreen.h	Wed Apr 29 23:45:08 2015 +0000
+++ b/GameScreen.h	Thu Apr 30 00:15:51 2015 +0000
@@ -42,6 +42,7 @@
     void displayCountdown();
     void displayEndScreen(int lvl,int *cursor);
     void displayRecordScreen(int *cursor, char ltr1, char ltr2,char ltr3);
+    void displayHighScores(char **initials,int *lvls);
     
     //Write Access, set
     void        setBallPos(int x, int y)        { playerBall.x = x; playerBall.y = y; }
--- a/main.cpp	Wed Apr 29 23:45:08 2015 +0000
+++ b/main.cpp	Thu Apr 30 00:15:51 2015 +0000
@@ -128,9 +128,9 @@
     
     //endScreenController();
     
-    
-    
-    serial.printf("%s \n",recordEntryController());
+    char *winners[3] = {"TRD","BOB","TOM"};
+    int lvls[3] = {11,9,8};
+    lcd.displayHighScores(winners,lvls);   
     
     return 1;
 }
@@ -308,12 +308,22 @@
         if (joystickButton.read()) {
             switch(cursorLoc) {
                 case 0:
-                    //take to initial entry page!
+                    //take to initial entry page! (only allow if score > top 3)
+                    recordEntryController();
+                    //write lvl and initials to csv
                     
+                    //take to high score page!
+                    lcd.displayHighScores();
+                    //reset once button pressed!
+                    while(!joystickButton.read()){}
+                    mbed_reset();
                     break;
                 case 1:
                     //take to high score page!
-        
+                    lcd.displayHighScores();
+                    //reset once button pressed.
+                    while(!joystickButton.read()){}
+                    mbed_reset();
                     break;
                 case 2:
                     //restart
@@ -387,3 +397,5 @@
 
 
 
+
+