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:
86:eecd168c3a23
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eencae 0:b7f1f47bb26a 1 /*
eencae 0:b7f1f47bb26a 2 ELEC2645 Embedded Systems Project
eencae 0:b7f1f47bb26a 3 School of Electronic & Electrical Engineering
eencae 0:b7f1f47bb26a 4 University of Leeds
evanso 85:87bc28b151d8 5 Name: Benjamin Evans
evanso 1:1f2ae263248e 6 Username:el18bpe
evanso 1:1f2ae263248e 7 Student ID Number:201216635
evanso 1:1f2ae263248e 8 Date:23/02/2020
eencae 0:b7f1f47bb26a 9 */
eencae 0:b7f1f47bb26a 10
evanso 13:12276eed13ac 11 // pre-processor directives ----------------------------------------------------
evanso 11:ab578a151f67 12 #include "GameEngine.h"
evanso 11:ab578a151f67 13
evanso 12:1c0b6796aaca 14 #ifdef GAME_TEST
evanso 67:a2984682d641 15 #include "test.h"
evanso 11:ab578a151f67 16 #endif
evanso 11:ab578a151f67 17
evanso 13:12276eed13ac 18 // Objects ---------------------------------------------------------------------
evanso 13:12276eed13ac 19
evanso 27:8bb2bd97c319 20 /** Define Game Engine object*/
evanso 8:dd1037c5435b 21 GameEngine engine;
evanso 11:ab578a151f67 22
evanso 84:f61c85a5f13a 23 // Functions -------------------------------------------------------------------
evanso 84:f61c85a5f13a 24
evanso 85:87bc28b151d8 25 /** Runs the different test for the game */
evanso 84:f61c85a5f13a 26 void test_game();
evanso 84:f61c85a5f13a 27
eencae 0:b7f1f47bb26a 28 int main()
evanso 3:dee187b8b30c 29 {
evanso 85:87bc28b151d8 30 // Initialise the game engine
evanso 42:3aed75338272 31 engine.init();
evanso 42:3aed75338272 32
evanso 84:f61c85a5f13a 33 // Tests game
evanso 84:f61c85a5f13a 34 test_game();
evanso 84:f61c85a5f13a 35
evanso 84:f61c85a5f13a 36 while (1) {
evanso 85:87bc28b151d8 37 // Selects the different parts of the game
evanso 84:f61c85a5f13a 38 engine.game_select_part();
evanso 84:f61c85a5f13a 39
evanso 84:f61c85a5f13a 40 // Sets frame rate to 20 FPS for menu system
evanso 84:f61c85a5f13a 41 wait(0.05);
evanso 84:f61c85a5f13a 42 }
evanso 84:f61c85a5f13a 43 }
evanso 84:f61c85a5f13a 44
evanso 84:f61c85a5f13a 45 void test_game(){
evanso 11:ab578a151f67 46 // Compile with tests
evanso 12:1c0b6796aaca 47 #ifdef GAME_TEST
evanso 84:f61c85a5f13a 48
evanso 83:35d1e846eab2 49 // Spaceship tests
evanso 13:12276eed13ac 50 run_spaceship_movement_tests();
evanso 13:12276eed13ac 51 run_spaceship_draw_tests();
evanso 84:f61c85a5f13a 52
evanso 83:35d1e846eab2 53 // Map tests
evanso 14:7419c680656f 54 run_map_draw_tests();
evanso 84:f61c85a5f13a 55
evanso 83:35d1e846eab2 56 // Alien tests
evanso 65:daa792a09e1f 57 run_alien_draw_tests();
evanso 65:daa792a09e1f 58 run_check_collision_test();
evanso 84:f61c85a5f13a 59
evanso 83:35d1e846eab2 60 // Weapons tests
evanso 23:cc44e26c08fa 61 run_weapons_draw_tests();
evanso 84:f61c85a5f13a 62
evanso 83:35d1e846eab2 63 // Explosion tests
evanso 26:1a7056eb3253 64 run_explosion_draw_tests();
evanso 84:f61c85a5f13a 65
evanso 83:35d1e846eab2 66 // People tests
evanso 37:a05eac7fcb4c 67 run_people_draw_tests();
evanso 84:f61c85a5f13a 68
evanso 83:35d1e846eab2 69 // Menu tests
evanso 65:daa792a09e1f 70 run_menu_select_part_test();
evanso 65:daa792a09e1f 71 run_menu_scroll_test();
evanso 70:8c4572d17441 72 run_menu_draw_part_test();
evanso 84:f61c85a5f13a 73
evanso 83:35d1e846eab2 74 // HUD tests
evanso 66:33f479036a5d 75 run_HUD_draw_test();
evanso 84:f61c85a5f13a 76
evanso 83:35d1e846eab2 77 // Saved Games tests
evanso 67:a2984682d641 78 run_saved_games_scroll_test();
evanso 67:a2984682d641 79 run_display_saved_games_test();
evanso 67:a2984682d641 80 run_save_game_screen_test();
evanso 84:f61c85a5f13a 81
evanso 83:35d1e846eab2 82 // Settings tests
evanso 70:8c4572d17441 83 run_settings_select_part_test();
evanso 70:8c4572d17441 84 run_settings_scroll_test();
evanso 70:8c4572d17441 85 run_display_settings_screen_test();
evanso 84:f61c85a5f13a 86
evanso 83:35d1e846eab2 87 // Play Engine tests
evanso 79:66bcf8fa2d2d 88 run_no_high_scores_test();
evanso 84:f61c85a5f13a 89
evanso 83:35d1e846eab2 90 // Play Engine tests
evanso 83:35d1e846eab2 91 run_read_accelerometer_direction_test();
evanso 83:35d1e846eab2 92 run_spawn_aliens_test();
evanso 83:35d1e846eab2 93 run_create_alien_test();
evanso 83:35d1e846eab2 94 run_create_explosion_test();
evanso 83:35d1e846eab2 95 run_spawn_people_test();
evanso 83:35d1e846eab2 96 run_reset_map_timer_test();
evanso 83:35d1e846eab2 97 run_reset_map_test();
evanso 84:f61c85a5f13a 98
evanso 84:f61c85a5f13a 99 #endif
evanso 85:87bc28b151d8 100 }