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.
Diff: GameEngine/GameEngine.cpp
- Revision:
- 68:bb1650c657ef
- Parent:
- 67:a2984682d641
- Child:
- 69:753ba27325ce
--- a/GameEngine/GameEngine.cpp Thu May 21 20:23:24 2020 +0000 +++ b/GameEngine/GameEngine.cpp Thu May 21 22:46:23 2020 +0000 @@ -87,32 +87,29 @@ lcd_frame_time_flag_ = 0; //Pause button pressed - if (pad.start_pressed()){ + if (pad.start_pressed() && paused_counter_ > 10 ){ paused_flag = !paused_flag; - wait(0.035); + paused_counter_ = 0 ; } + paused_counter_++; //Draws pause screen if paused button presed if (paused_flag){ - run_paused_game(); - + run_paused_game(); + //Otherwise draw gameplay screen }else{ gameplay_loop(); } - // break out of run play loop when lives = 0 + // break out of run play loop when lives = 0 or exite flag set + if(!spaceship_lives_||exit_flag_){ if(!spaceship_lives_){ draw_game_over_screen(); + } reset_map(); pad.leds_off(); break; - } - - //Returns to mainmenu if exit slected in pause screen - if(exit_flag_){ - reset_map(); - break; } } @@ -120,7 +117,7 @@ sleep(); } //stop taking double a press - wait(0.5); + wait(0.3); } void GameEngine::play_init(){ @@ -136,6 +133,7 @@ smart_bomb_timer_ = 0; bullet_timer_ = 0; lcd_frame_time_flag_ = 0; + paused_counter_ = 25; //Flags for screen control exit_flag_ = false; @@ -190,7 +188,6 @@ void GameEngine::run_paused_game(){ //Lunch save a game screen if (pad.B_pressed()||run_save_a_game_flag_){ - wait(0.035); run_save_a_game_flag_ = true; run_save_a_game(); @@ -202,7 +199,6 @@ //Exit to main menu if (pad.A_pressed()||saved.get_error()){ - wait(0.035); current_menu_part_ = main_menu; exit_flag_ = true; } @@ -229,8 +225,7 @@ saved.save_game_screen(lcd); //Save game to save file that is displayed - if (pad.A_pressed()){ - wait(0.035); + if (pad.A_pressed()){ //Define struct data SavedGamesData data;