Ben Evans / Mbed 2 deprecated Defender_Game

Dependencies:   mbed

Revision:
14:7419c680656f
Parent:
13:12276eed13ac
Child:
16:1ee3d3804557
--- a/Spaceship/Spaceship_test.h	Sun Apr 26 17:08:10 2020 +0000
+++ b/Spaceship/Spaceship_test.h	Sun Apr 26 20:31:53 2020 +0000
@@ -1,12 +1,6 @@
 #ifndef SPACESHIP_TEST_H
 #define SPACESHIP_TEST_H
 
-// Objects reqired for test ----------------------------------------------------
-Gamepad pad;
-N5110 lcd;
-Spaceship spaceship;
-Direction d_;
-
 /** Spaceship Test
 @brief Checks Spcaceship goes to the correct postion when moved and doesnt go of map
 @author Benjamin Evans, University of Leeds
@@ -15,10 +9,12 @@
 */
 
 bool spaceship_movement_test(Direction d_, int expected_x,int expected_y){
+    // Objects reqired for test ------------------------------------------------
+    Gamepad pad;
+    Spaceship spaceship;
     
     // Initialise spaceship in start postion of 36, 22 
     pad.init();
-    lcd.init();
     spaceship.init(); 
     
     printf("spaceship_movement = %d,%d : ", expected_x, expected_y );
@@ -42,6 +38,11 @@
 }
 
 bool spaceship_draw_test(Direction d_, int expected_pixel_status, int expected_postion_x, int expected_postion_y){
+    // Objects reqired for test ------------------------------------------------
+    Gamepad pad;
+    Spaceship spaceship;
+    N5110 lcd;
+    
     // Initialise spaceship in start postion of 36, 22 
     pad.init();
     lcd.init();
@@ -65,7 +66,6 @@
     int finish_x_postion = spaceship.get_position_x_spaceship();
     int finish_y_postion = spaceship.get_position_y_spaceship();
     
-    
     // Checks if pixel is drawn and therefor testing it hasnt gone of screen
     if (actual_pixel_status) {
         printf ( "Passed!\n");