ELEC2645 (2018/19) / Mbed 2 deprecated el17dg

Dependencies:   mbed

Fork of el17dg by Dmitrijs Griskovs

Committer:
Noximilien
Date:
Tue Apr 16 21:16:33 2019 +0000
Revision:
30:d454d0cb72bc
Parent:
29:579e00b7f118
Child:
31:becb8f6bf7b7
Hace modified some comments. Have added a feature of a force shield. Updated the tutorial, Have finished the settings mode.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Noximilien 3:10918b0f7a7d 1 #ifndef GAME_H
Noximilien 3:10918b0f7a7d 2 #define GAME_H
Noximilien 3:10918b0f7a7d 3
Noximilien 29:579e00b7f118 4 /** This variable is used in game.cpp, enemy.h, player.h and hud.h*/
Noximilien 25:749f1efc31fc 5 extern int game_score;
Noximilien 26:676874c42883 6 extern int score_count_for_difficulty;
Noximilien 25:749f1efc31fc 7 extern int player_lifes;
Noximilien 25:749f1efc31fc 8 extern bool red_led_state;
Noximilien 25:749f1efc31fc 9 extern int red_led_flashing;
Noximilien 28:35af3843de8f 10 extern int high_score;
Noximilien 24:0570cb4b92d7 11
Noximilien 29:579e00b7f118 12 /** Game Class
Noximilien 29:579e00b7f118 13 * @brief A library for drawing the game.
Noximilien 29:579e00b7f118 14 * @author Dmitrijs Griskovs
Noximilien 29:579e00b7f118 15 * @date 15/04/2019
Noximilien 29:579e00b7f118 16 */
Noximilien 4:02c63aaa2df9 17 class Game{
Noximilien 4:02c63aaa2df9 18 public:
Noximilien 29:579e00b7f118 19 /** @brief The main game function where all the gamplay happens.
Noximilien 29:579e00b7f118 20 * @details This is the main function of game.cpp, where the actual gameplay happens.
Noximilien 29:579e00b7f118 21 * Here all other functions are activeated, and when the player dies, it
Noximilien 29:579e00b7f118 22 * returns back to main menu "main.cpp".
Noximilien 30:d454d0cb72bc 23 * @returns bool want_to_pause, when "START" button is pressed.
Noximilien 29:579e00b7f118 24 */
Noximilien 27:f05f4e738ba9 25 bool updateAndDraw();
Noximilien 29:579e00b7f118 26 /** @brief Resets all the in game variable when new game begins.
Noximilien 29:579e00b7f118 27 * @details This function resets all the values to their intial states when
Noximilien 29:579e00b7f118 28 * the game is first began when the player dies and wants to restart the game.
Noximilien 29:579e00b7f118 29 * It does not reset the values when the game is paused.
Noximilien 29:579e00b7f118 30 */
Noximilien 21:0eb394495b8a 31 void startNewGame();
Noximilien 30:d454d0cb72bc 32 /** @brief Check whether the button R was pressed or not to turn ON/OFF the shield.
Noximilien 30:d454d0cb72bc 33 * @details When the button R is pressed it sets bool "is_shield_active" to its opposite
Noximilien 30:d454d0cb72bc 34 * value. If the shield is active then, a ship with force shield sprite is drawn and
Noximilien 30:d454d0cb72bc 35 * the player's ability to shoot deactivates.
Noximilien 30:d454d0cb72bc 36 */
Noximilien 30:d454d0cb72bc 37 bool forceShildActivate();
Noximilien 4:02c63aaa2df9 38 private:
Noximilien 27:f05f4e738ba9 39 bool checkForGameOver();
Noximilien 21:0eb394495b8a 40 void collideEnemiesAndBlasts();
Noximilien 21:0eb394495b8a 41 void collideEnemiesBlastsAndPlayer();
Noximilien 23:240bc00ef25b 42 void collideEnemiesAndPlayer();
Noximilien 26:676874c42883 43 void starsSpawnDelay();
Noximilien 26:676874c42883 44 void increaseGameDifficultyAndEnemySpawnDelay();
Noximilien 23:240bc00ef25b 45 void gameOver();
Noximilien 28:35af3843de8f 46 void drawGameOver();
Noximilien 29:579e00b7f118 47 void ledsGameOver();
Noximilien 29:579e00b7f118 48 void musicGameOver();
Noximilien 29:579e00b7f118 49 void printMusicCountersTest();
Noximilien 29:579e00b7f118 50 void lowFrequencyPartMusic();
Noximilien 29:579e00b7f118 51 void highFrequencyPartMusic();
Noximilien 30:d454d0cb72bc 52 bool returnToMenu();
Noximilien 3:10918b0f7a7d 53 };
Noximilien 3:10918b0f7a7d 54
Noximilien 3:10918b0f7a7d 55
Noximilien 3:10918b0f7a7d 56 #endif