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.

Committer:
evanso
Date:
Sun Apr 26 20:31:53 2020 +0000
Revision:
14:7419c680656f
Parent:
13:12276eed13ac
Child:
15:90b6821bcf64
Added map movement test unit and doxygen details to comments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 11:ab578a151f67 1 #ifndef TESTS_H
evanso 11:ab578a151f67 2 #define TESTS_H
evanso 11:ab578a151f67 3
evanso 11:ab578a151f67 4 #include "Spaceship_test.h"
evanso 14:7419c680656f 5 #include "Map_test.h"
evanso 11:ab578a151f67 6
evanso 11:ab578a151f67 7 /** Test
evanso 11:ab578a151f67 8 @brief Runs all tests for game
evanso 11:ab578a151f67 9 @author Benjamin Evans, University of Leeds
evanso 13:12276eed13ac 10 @date April 2020
evanso 11:ab578a151f67 11 */
evanso 13:12276eed13ac 12
evanso 13:12276eed13ac 13 // Spaceship tests -------------------------------------------------------------
evanso 13:12276eed13ac 14 void run_spaceship_movement_tests(){
evanso 13:12276eed13ac 15 printf ("\nTesting spaceship_movement_test() \n");
evanso 13:12276eed13ac 16 int passed_counter = 0;
evanso 13:12276eed13ac 17
evanso 13:12276eed13ac 18 // Runs test with all posible movment directions
evanso 13:12276eed13ac 19 if (spaceship_movement_test(CENTRE, 36, 22)) passed_counter++;
evanso 13:12276eed13ac 20 if (spaceship_movement_test(N, 36, 21)) passed_counter++;
evanso 13:12276eed13ac 21 if (spaceship_movement_test(NE, 37, 21)) passed_counter++;
evanso 13:12276eed13ac 22 if (spaceship_movement_test(E, 37, 22)) passed_counter++;
evanso 13:12276eed13ac 23 if (spaceship_movement_test(SE, 37, 23)) passed_counter++;
evanso 13:12276eed13ac 24 if (spaceship_movement_test(S, 36, 23)) passed_counter++;
evanso 13:12276eed13ac 25 if (spaceship_movement_test(SW, 35, 23)) passed_counter++;
evanso 13:12276eed13ac 26 if (spaceship_movement_test(W, 35, 22)) passed_counter++;
evanso 13:12276eed13ac 27 if (spaceship_movement_test(NW, 35, 21)) passed_counter++;
evanso 11:ab578a151f67 28
evanso 13:12276eed13ac 29 // prints results
evanso 13:12276eed13ac 30 printf ("\nspaceship_movement_test passed %d tests out of 9\n",passed_counter);
evanso 12:1c0b6796aaca 31 }
evanso 12:1c0b6796aaca 32
evanso 13:12276eed13ac 33 void run_spaceship_draw_tests(){
evanso 13:12276eed13ac 34 printf ("\nTesting spaceship_draw_tests() \n");
evanso 13:12276eed13ac 35 int passed_counter = 0;
evanso 12:1c0b6796aaca 36
evanso 13:12276eed13ac 37 // Runs test with max movement directions
evanso 13:12276eed13ac 38 if (spaceship_draw_test(NE, 1, 52, 0)) passed_counter++;
evanso 13:12276eed13ac 39 if (spaceship_draw_test(SE, 1, 52, 44)) passed_counter++;
evanso 13:12276eed13ac 40 if (spaceship_draw_test(SW, 1, 32, 44)) passed_counter++;
evanso 13:12276eed13ac 41 if (spaceship_draw_test(NW, 1, 32, 0)) passed_counter++;
evanso 13:12276eed13ac 42
evanso 13:12276eed13ac 43 // prints results
evanso 13:12276eed13ac 44 printf ("\nspaceship_draw_test passed %d tests out of 4\n",passed_counter);
evanso 11:ab578a151f67 45 }
evanso 11:ab578a151f67 46
evanso 13:12276eed13ac 47 // Map tests -------------------------------------------------------------------
evanso 13:12276eed13ac 48
evanso 14:7419c680656f 49 void run_map_draw_tests(){
evanso 14:7419c680656f 50 printf ("\nTesting map_draw_tests() \n");
evanso 14:7419c680656f 51 int passed_counter = 0;
evanso 14:7419c680656f 52
evanso 14:7419c680656f 53 // Runs multiple map tests
evanso 14:7419c680656f 54 if (map_move_test(84, 0)) passed_counter++;
evanso 14:7419c680656f 55 if (map_move_test(0, -84)) passed_counter++;
evanso 14:7419c680656f 56 if (map_move_test(150, 66)) passed_counter++;
evanso 14:7419c680656f 57 if (map_move_test(-150, -234)) passed_counter++;
evanso 14:7419c680656f 58
evanso 14:7419c680656f 59 // prints results
evanso 14:7419c680656f 60 printf ("\nmap_draw_test passed %d tests out of 4\n",passed_counter);
evanso 14:7419c680656f 61 }
evanso 13:12276eed13ac 62
evanso 11:ab578a151f67 63 #endif