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:
Mon May 18 00:18:58 2020 +0000
Revision:
42:3aed75338272
Parent:
41:5959256f4aab
Child:
43:d43759dbddb9
Play game part of the menu works. Gamepad launches into the menu and plays the game when selected.

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 1:1f2ae263248e 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 ----------------------------------------------------
eencae 0:b7f1f47bb26a 12 #include "mbed.h"
eencae 0:b7f1f47bb26a 13 #include "Gamepad.h"
eencae 0:b7f1f47bb26a 14 #include "N5110.h"
evanso 11:ab578a151f67 15 #include "GameEngine.h"
evanso 3:dee187b8b30c 16 #include "Spaceship.h"
evanso 6:12e8433382b3 17 #include "Map.h"
evanso 11:ab578a151f67 18
evanso 12:1c0b6796aaca 19 #ifdef GAME_TEST
evanso 11:ab578a151f67 20 # include "test.h"
evanso 11:ab578a151f67 21 #endif
evanso 11:ab578a151f67 22
evanso 42:3aed75338272 23 // TODO
evanso 25:70b55f5bfc87 24 // deffine headers porperly by commenting out and compiling
evanso 27:8bb2bd97c319 25 // fix alien test by doing random movement test
evanso 33:7fedd8029473 26 // move game engine functions and definietion in order
evanso 40:71f947254fda 27 // change include libaries to included headers
evanso 40:71f947254fda 28 // sort out main menu header file
evanso 40:71f947254fda 29 // go through and check params and comment fofucntions in docs
evanso 42:3aed75338272 30 // spaces at start of comment
evanso 42:3aed75338272 31 // full stops at end of comment
evanso 42:3aed75338272 32 // capital letters at start
eencae 0:b7f1f47bb26a 33
evanso 13:12276eed13ac 34 // Objects ---------------------------------------------------------------------
evanso 13:12276eed13ac 35
evanso 27:8bb2bd97c319 36 /** Define Ticker object for ISR*/
evanso 42:3aed75338272 37
evanso 13:12276eed13ac 38
evanso 27:8bb2bd97c319 39 /** Define Game Engine object*/
evanso 8:dd1037c5435b 40 GameEngine engine;
evanso 11:ab578a151f67 41
evanso 13:12276eed13ac 42 // Global variables ------------------------------------------------------------
evanso 3:dee187b8b30c 43
evanso 3:dee187b8b30c 44
evanso 13:12276eed13ac 45 // Function prototypes ---------------------------------------------------------
evanso 27:8bb2bd97c319 46
eencae 0:b7f1f47bb26a 47
evanso 13:12276eed13ac 48 // functions -------------------------------------------------------------------
eencae 0:b7f1f47bb26a 49 int main()
evanso 3:dee187b8b30c 50 {
evanso 42:3aed75338272 51 engine.init();
evanso 42:3aed75338272 52
evanso 3:dee187b8b30c 53 // Sets fram rate of lcd by using time-triggered tasks
evanso 42:3aed75338272 54 //ticker.attach(&engine, &GameEgine::lcd_frame_time_isr, 0.04);
evanso 42:3aed75338272 55
eencae 0:b7f1f47bb26a 56
evanso 11:ab578a151f67 57 // Compile with tests
evanso 12:1c0b6796aaca 58 #ifdef GAME_TEST
evanso 13:12276eed13ac 59 run_spaceship_movement_tests();
evanso 13:12276eed13ac 60 run_spaceship_draw_tests();
evanso 14:7419c680656f 61 run_map_draw_tests();
evanso 39:fc5586b930e3 62 run_alien_movement_tests();
evanso 39:fc5586b930e3 63 run_alien_collision_test();
evanso 23:cc44e26c08fa 64 run_weapons_draw_tests();
evanso 26:1a7056eb3253 65 run_explosion_draw_tests();
evanso 37:a05eac7fcb4c 66 run_people_draw_tests();
evanso 11:ab578a151f67 67 #endif
evanso 42:3aed75338272 68
evanso 40:71f947254fda 69
evanso 3:dee187b8b30c 70 while (1) {
evanso 40:71f947254fda 71
evanso 8:dd1037c5435b 72
evanso 42:3aed75338272 73 engine.game_select_part();
evanso 42:3aed75338272 74 wait_ms(50);
evanso 42:3aed75338272 75
evanso 42:3aed75338272 76
evanso 40:71f947254fda 77
evanso 3:dee187b8b30c 78 }
evanso 42:3aed75338272 79 }