contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Revision:
23:2ca9735b16ef
Parent:
21:5c98996d1487
Child:
24:a049cef2cc2e
diff -r 3e6ff378d651 -r 2ca9735b16ef GameEngine/RocketRacer.cpp
--- a/GameEngine/RocketRacer.cpp	Thu Apr 18 23:13:24 2019 +0000
+++ b/GameEngine/RocketRacer.cpp	Fri Apr 19 19:50:23 2019 +0000
@@ -72,16 +72,19 @@
      && Init_position!=3 && control==true){//statement to check if the joystick moved right
         Init_position++;//increments the position of the player sprite 
         control = false; //sets the flag to false
+        wait(0.01);// small delay to prevent previous press being detected again
 //        printf("its Right\n");
     }
     else if( (d==W ||pad.check_event(Gamepad::L_PRESSED) == true )
     && Init_position!=1 && control==true){//statement to check if the joystick moved left
         Init_position--;//decrements the position of the player sprite
         control = false;//sets the flag to false
+        wait(0.01);// small delay to prevent previous press being detected again
 //        printf("its left\n");
     }
     else if(d==CENTRE){//statement to check if the joystick position is center
         control = true;//sets the flag to true
+        wait(0.01);
 //        printf("its center\n");
         }
 }