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:
Wed May 27 02:06:05 2020 +0000
Revision:
87:832ca78426b5
Parent:
85:87bc28b151d8
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
evanso 12:1c0b6796aaca 1 #ifndef MAP_TEST_H
evanso 12:1c0b6796aaca 2 #define MAP_TEST_H
evanso 12:1c0b6796aaca 3
evanso 12:1c0b6796aaca 4 /** Map Test
evanso 85:87bc28b151d8 5 * @brief Checks that the map moves to the correct x position depending on
evanso 27:8bb2bd97c319 6 * joystick input
evanso 27:8bb2bd97c319 7 * @author Benjamin Evans, University of Leeds
evanso 27:8bb2bd97c319 8 * @date April 2020
evanso 27:8bb2bd97c319 9 * @return true if test are passed
evanso 27:8bb2bd97c319 10 */
evanso 82:3211b31e9421 11 bool map_move_test(Direction d_, int expected_x_position) {
evanso 85:87bc28b151d8 12 // Objects required for test
evanso 67:a2984682d641 13 Map map;
evanso 67:a2984682d641 14 N5110 lcd;
evanso 14:7419c680656f 15 Gamepad pad;
evanso 12:1c0b6796aaca 16
evanso 85:87bc28b151d8 17 // Initialise map in start position of -84,42
evanso 14:7419c680656f 18 pad.init();
evanso 14:7419c680656f 19 map.init(pad);
evanso 12:1c0b6796aaca 20
evanso 18:11068b98e261 21 printf("Espected map x position = %d, : ",expected_x_position);
evanso 12:1c0b6796aaca 22
evanso 14:7419c680656f 23 // Draws map but with move variable set so it starts above 0
evanso 14:7419c680656f 24 // As can't rea pixel of the LCD
evanso 18:11068b98e261 25 map.draw_map(lcd, d_);
evanso 12:1c0b6796aaca 26
evanso 85:87bc28b151d8 27 // Reads start position of map drawn
evanso 14:7419c680656f 28 int map_start_draw_postion = map.get_position_x_map();
evanso 12:1c0b6796aaca 29
evanso 85:87bc28b151d8 30 // Checks final position with expected
evanso 14:7419c680656f 31 if (map_start_draw_postion == expected_x_position) {
evanso 14:7419c680656f 32 printf ( "Passed!\n");
evanso 14:7419c680656f 33 return true;
evanso 14:7419c680656f 34 } else {
evanso 27:8bb2bd97c319 35 printf ( "Failed! value = %d, (expecting %d)\n",
evanso 27:8bb2bd97c319 36 map_start_draw_postion, expected_x_position);
evanso 14:7419c680656f 37 return false;
evanso 12:1c0b6796aaca 38 }
evanso 14:7419c680656f 39 }
evanso 12:1c0b6796aaca 40
evanso 85:87bc28b151d8 41 #endif