contains my game for the embedded systems project 2645

Dependencies:   mbed FXOS8700CQQQ

Revision:
29:e660274d8222
Parent:
28:39607fb67e88
Child:
33:24ef796ff2c8
diff -r 39607fb67e88 -r e660274d8222 GameTests/tests.cpp
--- a/GameTests/tests.cpp	Wed Apr 24 10:19:07 2019 +0000
+++ b/GameTests/tests.cpp	Thu Apr 25 10:44:53 2019 +0000
@@ -6,6 +6,10 @@
 tests::tests(){
     
 }
+
+tests::~tests(){
+    
+}
 void tests::test_welcomeMenu(Gamepad &pad,N5110 &lcd){
     menu.welcomeMenu(pad,lcd);
 }
@@ -33,8 +37,42 @@
     menu.InstructionsMenu(pad,lcd);
 }
 
+///////////////////////////////////////////////
+bool tests::test_Joystick_position(Gamepad &pad){
 
-//testing game
+    Direction d=pad.get_direction();//assigning the object d to the method to get the joystick direction
+
+    if( (d==E||pad.check_event(Gamepad::R_PRESSED) == true )){//statement to check if the joystick moved right  
+        printf("its Right\n");
+        return true;
+    }
+    else if( (d==W ||pad.check_event(Gamepad::L_PRESSED) == true )){//statement to check if the joystick moved left
+        printf("its left\n");
+        return true;
+    }
+    else if(d==CENTRE){//statement to check if the joystick position is center
+        wait(0.01);
+        printf("its center\n");
+        return true;
+        }
+        return false;
+}
+
+
+bool tests::test_Generate_New_Enemy(){
+  
+    srand(time(NULL));//seeding the random function
+    
+    int second_enemy_position = (rand() % 3)+1;//generates a random number from 1 to 3 
+    printf("%d",second_enemy_position);
+    if(second_enemy_position==1||second_enemy_position==2||second_enemy_position==3){
+        return true;
+        }
+        return false;
+
+}
+
+//testing game loop
 ////////////////////////////////////////////////
 void tests::test_Game_Loop(Gamepad &pad,N5110 &lcd){
     while(1){