contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Revision:
32:e5d997d2ed79
Parent:
31:4d4a9d78cae5
Child:
33:24ef796ff2c8
--- a/GameEngine/RocketRacer.cpp	Sun Apr 28 02:43:58 2019 +0000
+++ b/GameEngine/RocketRacer.cpp	Mon Apr 29 17:34:37 2019 +0000
@@ -1,6 +1,6 @@
 #include "RocketRacer.h"
 
-
+// create object and specifiy pins
 FXOS8700CQ device(I2C_SDA,I2C_SCL);
 
 //default constructor of the class and initializing the private variables
@@ -31,15 +31,23 @@
 void RocketRacer::set_game_score(int score) {
  score = score;
 }
+
+
 void RocketRacer::set_enemy_dead(bool enemy_dead) {
  enemy_dead = enemy_dead;
 }
+
+
 void RocketRacer::set_control(bool control) {
  control = control;
 }
+
+
 void RocketRacer::set_init_position(int Init_position) {
  Init_position = Init_position;
 }
+
+
 void RocketRacer::Main_Game_Display(N5110 &lcd){
      
     lcd.clear(); //clears the lcd 
@@ -71,19 +79,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.09);// small delay to prevent previous press being detected again
+        wait(0.1);// small delay to prevent previous press being detected again
 //        printf("its Right\n");
     }
     else if( (pitchAngle < 90 )
     && 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.09);// small delay to prevent previous press being detected again
+        wait(0.01);// small delay to prevent previous press being detected again
 //        printf("its left\n");
     }
     else {//statement to check if the joystick position is center
         control = true;//sets the flag to true
-        wait(0.09);
+        wait(0.01);
 //        printf("its center\n");
         }    
 }