Initial Flappy mbed Game

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

Revision:
2:22aa1c22ec77
Parent:
1:7d3e4ff9727c
Child:
3:642d90f34496
--- a/main.cpp	Mon Mar 24 14:19:38 2014 +0000
+++ b/main.cpp	Mon Mar 24 15:04:47 2014 +0000
@@ -58,6 +58,22 @@
     }
 }
 
+void playDeadSound(void const *argument) {
+    while(1) {
+    Thread::signal_wait(0x1);
+    //open wav file
+    FILE *wave_file;
+    wave_file=fopen("/sd/sfx_die.wav","r");
+    
+    //play wav file
+    waver.play(wave_file);
+    
+    //close wav file
+    fclose(wave_file);
+    }
+}
+
+
 void pb1_hit_callback() {
        
        switch (state) {
@@ -77,6 +93,7 @@
     
     state = begin;
     Thread thread(playPointSound);
+    Thread thread2(playDeadSound);
     
     wave_file=fopen("/sd/sfx_point.wav","r");
     
@@ -212,6 +229,25 @@
     
             //close wav file
             fclose(wave_file2);
+            
+            if (ballypos < 125)
+            {
+               //wave_file2=fopen("/sd/sfx_die.wav","r");
+    
+                //play wav file
+                //waver.play(wave_file2);
+    
+                //close wav file
+                //fclose(wave_file2);
+                
+                thread2.signal_set(0x1);
+                
+                for (int i = ballypos; i < 125; i++)
+                {
+                     uLCD.filled_circle(ballxpos, i, ballrad, 0x0000FF);
+                     uLCD.filled_circle(ballxpos, i+1, ballrad, 0xFF00FF);   
+                }    
+            }
         
             uLCD.locate(5,8);
             uLCD.color(WHITE);