Ben Evans University Second Year Project. Game Called Defender.

Dependencies:   mbed

https://os.mbed.com/media/uploads/evanso/84bc1a30759fd6a1e3f1fd1fae3e97c2.png

Hello, soldier, you have been specially selected as the defender of planet earth.

Your mission, if you choose to accept it. Fly around the planet and pulverise invading alien ships for as long as you can. Stop the aliens abducting the innocent people on the ground. Be warned if an alien ship manages to abduct a person and take them to top of the screen, they will no longer move randomly and will begin to hunt you down. This sounds like a challenge you were trained for.

But don’t worry soldier you’re not going into battle empty-handed. Your ship is equipped with a state of the art laser beam that has unlimited ammo and four smart bombs that will destroy anything on the screen. The ship also has three lives so use them wisely.

As time goes on more alien ships will arrive on planet earth increasing the difficulty of your mission. And remember the landscape bellow loops around so if you continually fly in the same direction you go to your original position. Good luck soldier.

Revision:
82:3211b31e9421
Parent:
79:66bcf8fa2d2d
Child:
83:35d1e846eab2
diff -r 78c461e6770b -r 3211b31e9421 test.h
--- a/test.h	Mon May 25 15:59:14 2020 +0000
+++ b/test.h	Mon May 25 18:39:51 2020 +0000
@@ -1,6 +1,7 @@
 #ifndef TESTS_H
 #define TESTS_H
 
+// Included Headers ------------------------------------------------------------
 #include "Spaceship_test.h"
 #include "Map_test.h"
 #include "Alien_test.h"
@@ -20,7 +21,7 @@
  */
 // Spaceship tests -------------------------------------------------------------
 
-void run_spaceship_movement_tests(){
+void run_spaceship_movement_tests() {
     printf ("\nTesting spaceship_movement_test() \n");
     int passed_counter = 0;
 
@@ -35,12 +36,12 @@
     if (spaceship_movement_test(W, 37, 22)) passed_counter++;
     if (spaceship_movement_test(NW, 37, 21)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nspaceship_movement_test passed %d tests out of 9\n\n\n",
     passed_counter);
 }
 
-void run_spaceship_draw_tests(){
+void run_spaceship_draw_tests() {
     printf ("\nTesting spaceship_draw_tests() \n\n");
     int passed_counter = 0;
     
@@ -50,7 +51,7 @@
     if (spaceship_draw_test(SW, 1, 64, 44)) passed_counter++;
     if (spaceship_draw_test(NW, 1, 64, 9)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nspaceship_draw_test passed %d tests out of 4\n\n\n",passed_counter);
 }
 
@@ -58,7 +59,7 @@
 
 // Map tests -------------------------------------------------------------------
 
-void run_map_draw_tests(){
+void run_map_draw_tests() {
     printf ("\nTesting map_draw_tests() \n\n");
     int passed_counter = 0;
     
@@ -73,7 +74,7 @@
     if (map_move_test(W, -82)) passed_counter++;
     if (map_move_test(NW, -82)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nmap_draw_test passed %d tests out of 9\n\n\n",passed_counter);
 }
 
@@ -81,7 +82,7 @@
 
 // Alien tests -----------------------------------------------------------------
 
-void run_alien_draw_tests(){
+void run_alien_draw_tests() {
     printf ("\nTesting alien_draw_test() \n\n");
     int passed_counter = 0;
 
@@ -96,11 +97,11 @@
     if (alien_draw_test(1,E, 70, 5)) passed_counter++;
     if (alien_draw_test(1,NE, 6, 44)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nalien_draw_test passed %d tests out of 9\n\n\n",passed_counter);
 }
 
-void run_check_collision_test(){
+void run_check_collision_test() {
     printf ("\nTesting alien_collision_test() \n\n");
     int passed_counter = 0;
 
@@ -110,14 +111,14 @@
     if (check_collision_test(1, 0, 11,22)) passed_counter++;
     if (check_collision_test(0, 0, 20,22)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nalien_draw_test passed %d tests out of 4\n\n\n",passed_counter);
 }
 
 
 // Weapons tests ---------------------------------------------------------------
 
-void run_weapons_draw_tests(){
+void run_weapons_draw_tests() {
     printf ("\nTesting spaceship_draw_tests() \n\n");
     int passed_counter = 0;
     
@@ -129,7 +130,7 @@
     if (weapons_draw_test(1, 0, 2, 33, 24)) passed_counter++;
     if (weapons_draw_test(0, 0, 2, 33, 24)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nspaceship_draw_test passed %d tests out of 6\n\n\n",passed_counter);
 }
 
@@ -137,7 +138,7 @@
 
 // Explosion tests -------------------------------------------------------------
 
-void run_explosion_draw_tests(){
+void run_explosion_draw_tests() {
     printf ("\nTesting explosion_draw_tests() \n\n");
     int passed_counter = 0;
     
@@ -147,7 +148,7 @@
     if (explosion_draw_test(1, 64, 44)) passed_counter++;
     if (explosion_draw_test(1, 64, 2)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nspaceship_draw_test passed %d tests out of 4\n\n\n",passed_counter);
 }
 
@@ -155,7 +156,7 @@
 
 // People tests ----------------------------------------------------------------
 
-void run_people_draw_tests(){
+void run_people_draw_tests() {
     printf ("\nTesting people_draw_tests() \n\n");
     int passed_counter = 0;
     
@@ -170,11 +171,11 @@
     if (people_draw_test(W, 0,-6)) passed_counter++;
     if (people_draw_test(NW, 0,84)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\npeople_draw_test passed %d tests out of 9\n\n\n",passed_counter);
 }
 
-void run_check_alien_collision_test(){
+void run_check_alien_collision_test() {
     printf ("\nTesting check_alien_collision_test() \n\n");
     int passed_counter = 0;
 
@@ -184,7 +185,7 @@
     if (check_alien_collision_test(1,-42)) passed_counter++;
     if (check_alien_collision_test(1,100)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\ncheck_alien_collision_test passed %d tests out of 4\n\n\n",
     passed_counter);
 }
@@ -193,7 +194,7 @@
 
 // Menu tests ------------------------------------------------------------------
 
-void run_menu_select_part_test(){
+void run_menu_select_part_test() {
     printf ("\nTesting menu_select_part_test() \n\n");
     int passed_counter = 0;
 
@@ -201,12 +202,12 @@
     if (menu_select_part_test(play,1)) passed_counter++;
     if (menu_select_part_test(main_menu,0)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nmenu_select_part_test passed %d tests out of 2\n\n\n",
     passed_counter);
 }
 
-void run_menu_scroll_test(){
+void run_menu_scroll_test() {
     printf ("\nTesting menu_scroll_test() \n\n");
     int passed_counter = 0;
 
@@ -221,12 +222,12 @@
     if (menu_scroll_test(W,  play)) passed_counter++;
     if (menu_scroll_test(NW, settings)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nmenu_scroll_test passed %d tests out of 9\n\n\n",
     passed_counter);
 }
 
-void run_menu_draw_part_test(){
+void run_menu_draw_part_test() {
     printf ("\nmenu_draw_part_test() \n\n");
     int passed_counter = 0;
 
@@ -236,7 +237,7 @@
     if (menu_draw_part_test(0, 9, 1)) passed_counter++;
     if (menu_draw_part_test(0, 0, 0)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\nmenu_draw_part_test %d tests out of 4\n\n\n",
     passed_counter);
 }
@@ -246,7 +247,7 @@
 
 // HUD tests -------------------------------------------------------------------
 
-void run_HUD_draw_test(){
+void run_HUD_draw_test() {
     printf ("\nTesting HUD_draw_test() \n\n");
     int passed_counter = 0;
 
@@ -259,7 +260,7 @@
     if (HUD_draw_test(3, 0, 3, 1, 30, 3)) passed_counter++;
     if (HUD_draw_test(3, 1111, 3, 00, 30, 3)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\nHUD_draw_test passed %d tests out of 7\n\n\n",
     passed_counter);
 }
@@ -269,7 +270,7 @@
 
 // Saved Games tests -----------------------------------------------------------
 
-void run_saved_games_scroll_test(){
+void run_saved_games_scroll_test() {
     printf ("\nsaved_games_scroll_test() \n\n");
     int passed_counter = 0;
 
@@ -284,12 +285,12 @@
     if (saved_games_scroll_test(W,  1)) passed_counter++;
     if (saved_games_scroll_test(NW, 2)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nsaved_games_scroll_test passed %d tests out of 9\n\n\n",
     passed_counter);
 }
 
-void run_display_saved_games_test(){
+void run_display_saved_games_test() {
     printf ("\nTesting display_saved_games_test() \n\n");
     int passed_counter = 0;
 
@@ -299,12 +300,12 @@
     if (display_saved_games_test(1, 9, 1)) passed_counter++;
     if (display_saved_games_test(0, 0, 0)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\ndisplay_saved_games_test %d tests out of 4\n\n\n",
     passed_counter);
 }
 
-void run_save_game_screen_test(){
+void run_save_game_screen_test() {
     printf ("\nTesting save_game_screen_test() \n\n");
     int passed_counter = 0;
 
@@ -314,7 +315,7 @@
     if (save_game_screen_test(1, 3, 1)) passed_counter++;
     if (save_game_screen_test(0, 0, 0)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\nsave_game_screen_test %d tests out of 4\n\n\n",
     passed_counter);
 }
@@ -323,7 +324,7 @@
 
 // Settings tests --------------------------------------------------------------
 
-void run_settings_select_part_test(){
+void run_settings_select_part_test() {
     printf ("\nTesting settings_select_part_test() \n\n");
     int passed_counter = 0;
 
@@ -331,12 +332,12 @@
     if (settings_select_part_test(acc,1)) passed_counter++;
     if (settings_select_part_test(joy,0)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nsettings_select_part_test passed %d tests out of 2\n\n\n",
     passed_counter);
 }
 
-void run_settings_scroll_test(){
+void run_settings_scroll_test() {
     printf ("\nsettings_scroll_test() \n\n");
     int passed_counter = 0;
 
@@ -351,12 +352,12 @@
     if (settings_scroll_test(W,  controls)) passed_counter++;
     if (settings_scroll_test(NW, sound_fx)) passed_counter++;
     
-    // prints results
+    // Prints results
     printf ("\nsettings_scroll_test passed %d tests out of 9\n\n\n",
     passed_counter);
 }
 
-void run_display_settings_screen_test(){
+void run_display_settings_screen_test() {
     printf ("\ndisplay_settings_screen_test() \n\n");
     int passed_counter = 0;
 
@@ -366,7 +367,7 @@
     if (display_settings_screen_test(0, 9, 1)) passed_counter++;
     if (display_settings_screen_test(0, 0, 0)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\ndisplay_settings_screen_test %d tests out of 4\n\n\n",
     passed_counter);
 }
@@ -376,7 +377,7 @@
 
 // High Score tests ------------------------------------------------------------
 
-void run_no_high_scores_test(){
+void run_no_high_scores_test() {
     printf ("\nno_high_scores_test_test() \n\n");
     int passed_counter = 0;
 
@@ -386,7 +387,7 @@
     if (no_high_scores_test(0, 9, 1)) passed_counter++;
     if (no_high_scores_test(0, 0, 0)) passed_counter++;
        
-    // prints results
+    // Prints results
     printf ("\nno_high_scores_test %d tests out of 4\n\n\n",
     passed_counter);
 }