Ben Evans University Second Year Project. Game Called Defender.
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.
Map/Map_test.h@67:a2984682d641, 2020-05-21 (annotated)
- Committer:
- evanso
- Date:
- Thu May 21 20:23:24 2020 +0000
- Revision:
- 67:a2984682d641
- Parent:
- 27:8bb2bd97c319
- Child:
- 82:3211b31e9421
Added SaveGame unit test which all passed! Had to define the unit test that tests actually saving and reading from a file as kept getting an error when declaring the sd object.
Who changed what in which revision?
User | Revision | Line number | New 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 | 27:8bb2bd97c319 | 5 | * @brief Checks that the map moves to the correct x position depedning 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 | 18:11068b98e261 | 11 | bool map_move_test(Direction d_, int expected_x_position){ |
evanso | 21:f7d7834e3af1 | 12 | // Objects reqired 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 | 14:7419c680656f | 17 | // Initialise map in start postion 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 | 14:7419c680656f | 27 | //Reads start postion of map drawn |
evanso | 14:7419c680656f | 28 | int map_start_draw_postion = map.get_position_x_map(); |
evanso | 12:1c0b6796aaca | 29 | |
evanso | 14:7419c680656f | 30 | // Checks final position with espected |
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 | 12:1c0b6796aaca | 41 | #endif |