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.

Revision:
72:e7492591307e
Parent:
69:753ba27325ce
Child:
74:6827b43c689d
--- a/Menu/Menu.cpp	Fri May 22 17:47:48 2020 +0000
+++ b/Menu/Menu.cpp	Sat May 23 21:35:16 2020 +0000
@@ -24,8 +24,16 @@
 void Menu::init() {
     current_menu_part_ = main_menu;
     displayed_menu_part_ = play;
+    //attach ticker to isr 
+    ticker_title.attach(callback(this, &Menu::title_screen_isr), 0.9 );
+    title_screen_flag_ = true;
 }
 
+void Menu::title_screen_isr(){
+    // set ISR flag
+    title_screen_flag_ = !title_screen_flag_; 
+} 
+
 void Menu::draw_part(N5110 &lcd) {
     // Prints the menu part that should be displayed in the centre
     if(displayed_menu_part_ == play){
@@ -38,7 +46,13 @@
         
     lcd.drawSprite(39, 26, 3, 5, (int *)arrow_up);
     lcd.drawSprite(39, 42, 3, 5, (int *)arrow_down);
-    title_screen(lcd);
+    
+    //flashes title screen
+    if(title_screen_flag_){
+        title_screen(lcd);
+    }else{
+        lcd.printString("DEFENDER",18,1);
+    }
     
     #ifdef MENU_DEBUG 
         printf("displayed_menu_part_ = %d\n",displayed_menu_part_);       
@@ -50,7 +64,7 @@
     //printf("displayed_menu_part_ %d\n",displayed_menu_part_);
     //printf("d = %d\n",d_);
     // Changes displayed manu part depending on joystick input
-    if (d_ == N || d_ == NE || d_ == NW ) {   
+    if (d_ == N || d_ == NE || d_ == NW ) {  
         displayed_menu_part_ = menu_fsm[displayed_menu_part_].part_next;   
     } else if (d_ == S || d_ == SW || d_ == SE) {
         displayed_menu_part_ = menu_fsm[displayed_menu_part_].part_next;