Initial Flappy mbed Game

Dependencies:   4DGL-uLCD-SE PinDetect SDFileSystem mbed-rtos mbed wave_player

Files at this revision

API Documentation at this revision

Comitter:
jmelliadis3
Date:
Mon Mar 24 19:23:12 2014 +0000
Parent:
2:22aa1c22ec77
Commit message:
Initial Flappy mbed Game!

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 22aa1c22ec77 -r 642d90f34496 main.cpp
--- a/main.cpp	Mon Mar 24 15:04:47 2014 +0000
+++ b/main.cpp	Mon Mar 24 19:23:12 2014 +0000
@@ -115,6 +115,7 @@
     uLCD.printf("%04d", score);
     
     int go = 1;
+    int scoreWrite = 1;
     while(go) {
         
         switch (state) {
@@ -174,6 +175,14 @@
         
             wall1y2 = rand() % (73) + 8;
             wall2y1 = wall1y2 + 48;
+            scoreWrite = 1;
+        }
+        
+        if(wall1x2 < 95 && scoreWrite == 1)
+        {
+            uLCD.locate(14,0);
+            uLCD.printf("%04d", score);
+            scoreWrite = 0;
         }