ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
48:bd1f31fbfee3
Parent:
47:3425159c0211
Child:
49:9bea7089b657
--- a/Gameengine/Gameengine.h	Wed Apr 24 14:27:00 2019 +0000
+++ b/Gameengine/Gameengine.h	Wed Apr 24 15:20:01 2019 +0000
@@ -23,38 +23,34 @@
 
     Gameengine();
     ~Gameengine();
- /** 
-  * @brief Initialises all default game settings.
+ /** Initialises all default game settings.
+  * @details Sets player starting position, number of lives, level start and timer.
   */
     void game_init();
- /** updates all game game settings.
+ /** Updates all game game settings.
+  * @details Contains all functions that update player position and game conditions
+  such as lives left, timer, game over and level complete.
   */
     void update(N5110 &lcd, Gamepad &pad);
- /** 
-  * @brief updates and renders all level objects for level 1.
+ /** Updates and renders all level objects for level 1.
   */
     void draw_l1(N5110 &lcd, Gamepad &pad);
- /** 
-  * @brief updates and renders all level objects for level 2.
+ /** Updates and renders all level objects for level 2.
   */
     void draw_l2(N5110 &lcd, Gamepad &pad);
- /** 
-  * @brief updates and renders all level objects for level 3.
+ /** Updates and renders all level objects for level 3.
   */
-  
     void draw_l3(N5110 &lcd, Gamepad &pad);
  /** 
   * @brief Reads direction the player is moving.
   * @details Uses getdirection() function from Gamepad library.
   */
     void read_direction(Gamepad &pad);
- /** 
-  * @brief Calculates lives remaining.
+ /** Calculates lives remaining.
   * @returns integer calue to control lives fsm state in leds() main.cpp
   */
     int oxygen_leds();
- /** 
-  * @brief Calculates time remaining.
+ /** Calculates time remaining.
   * @details Calculates time remaining, every 1/3 of total time passed the return 
   * value changes.
   * @return integer value to control oxygen fsm state in leds() main.cpp
@@ -67,81 +63,75 @@
   * adds on 10 points for every key collected.
   */ 
     void get_score(N5110 &lcd);
-/** 
-  * @brief Returns true if game completed.
+/** Returns true if game completed.
   * @details calculates when _level variable has gone beyond number of levels in game.
   * @return true if game complete
   */ 
     bool game_complete(N5110 &lcd);
-
- /** 
-  * @brief Reduces number of lives on player death.
+ /** Reduces number of lives on player death.
   * @details After reducing lives, makes tone to signify player death, resets player
-  * back to start, creates small pause so gameplay is slightly paused.
+  * back to start, creates small pause.
   */
     void lose_life(Gamepad &pad, N5110 &lcd);
- /** 
-  * @brief States whether game over condition met
+ /** States whether game over condition met
   * @return returns true if game over.
   */
     bool game_over();
- /** 
-  * @brief Function returns true when player at exit.
-  * @details Function returns true when the player is in contact with the level exit.
+ /** Returns true when player at exit.
+  * @return Function returns true when the player is in contact with the level exit.
   */
     bool level_exit(N5110 &lcd);
- /** 
-  * @brief Function returns true when level complete conditions met.
+ /** Returns true when level complete conditions met.
   * @details Function returns true when all 5 keys have been collected using _sprites.keys_collected()
-  * and player is in contact with the level exit using level_exit() function
-  * The calculates time reamining then resets, resets enemy and key flags
+  * and player is in contact with the level exit using level_exit() function.
+  * Calculates time reamining then resets, resets enemy and key flags
   * so they can be initialised for the next level, increases _level by 1 so next
-  * level can be drawn, keys needed increased by 5 and miner position reset.
+  * level will be drawn, keys needed increased by 5 and miner position reset.
   */
     void next_level(N5110 &lcd);
- /** 
-  * @brief Function returns true if player in contact with trap
+ /** Returns true if player in contact with trap
   * @details Function sets all trap poisitons and collision rules. Usues int i
   * to select which level positions to use.
   */
     bool trap_death(N5110 &lcd);
- /** 
-  * @brief Function returns true if player in contact with trap.
+ /** Returns true if player in contact with trap.
   * @details Function sets all trap positons and collision rules stated in
   * Sprites class. Uses int i to select which level positions to use, these are
   * specified in Level class.
   */
     void key_draw(N5110 &lcd,Gamepad &pad);
- /** 
-  * @brief Function sets all block positions and collision rules.
+ /** Sets all block positions and collision rules.
   * @details Function sets all block positons and collision rules stated in
   * Sprites class. Keys are indexed so each one is treated independently
   * otherwise all will disappear if one is collected. Uses int i to select which
-  * level positions to use, these are specified in Level class
+  * level positions to use, these are specified in Level class.
   */
     void blocks(N5110 &lcd);
+ /** Initialises enemies, updates movements and detects collision with player.
+  * @details Only initialises enemies when enem_flag set to false and sets it true
+  * once done. Function also updates enemy position and detects collision with players,
+  * int i states which level settings to use
+  
+  */
     bool enemies(N5110 &lcd);
+ /** Reinitialises keys once new level starts.
+  * @details Once level is complete the _key_reint flag is set to false and all
+  * 5 level keys are set to false. This means they are drawn in new positions as
+  * per int i which states which level settings to use in key_draw().
+  
+  */
     void key_reinit();
 
 private:
     
     int _level;
     int _lives;
-    double _x;
-    double _y;
-    int _distance;
-    int _turn_flag;
-    int _counter;
     bool _enem_flag;
     int _five_keys;
     bool _key_reinit;
     int _oxy_state;
     int _life_state;
     float _total_time;
-
-    
-    float _time_total;
-
     float _time;
     
     Sprites _sprites;