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:
Fri May 01 20:37:10 2020 +0000
Revision:
18:11068b98e261
Parent:
16:1ee3d3804557
Child:
22:053c11a202e1
Added functions so if button A is press the spaceship shoots a bullet.

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