Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Game/Game.h
- Revision:
- 25:3995271e411c
- Parent:
- 22:236319885874
- Child:
- 26:8a85aede976d
diff -r 4e8bdcb74266 -r 3995271e411c Game/Game.h
--- a/Game/Game.h	Wed Apr 03 16:19:05 2019 +0000
+++ b/Game/Game.h	Wed Apr 03 20:03:47 2019 +0000
@@ -11,28 +11,66 @@
 #include "Gamepad.h"
 #include "mbed.h"
 
+/** Game class
+*@brief A class used to instantiate a cube object, this is the obstacle in the game
+*@author Christopher Doel
+*@date April, 2019
+*/
+
 class Game {
   private:
+    bool backToMenu;
     int noOfCubes;
     int homeSelection;
-    bool selection;
+    bool deathMenuSelection;
     bool playing;
     int score;
     Vector2D coord;
-    Cube cubeArray[30];
-    Face faceArray[180];
+    Cube cubeArray[25];
+    Face faceArray[150];
 
     Ticker ticker;
     Gamepad gamepad;
     Rasturizer renderer;
     
     void addScore();
+    /** @brief Increments the score by 1
+    */
     void resetScore();
-    void deathScreen();
-    bool deathButtonSelections();
+    /** @brief Resets the score to 0
+    */
+    void checkDespawn(Cube *cube);
+    /** @brief Checks whether a cube needs to be despawned, if it does then the cube will be translated to the far side of the map
+    *@param A pointer to a cube object
+    */
+    void checkDeath(Cube *cube);
+    /** @brief Checks whether a cube is too close to the user and therefore a collision has occured, the game will be stopped if true
+    *@param A pointer to a cube object
+    */
+    void cubeToBeRendered(Cube *cube, int cubeIndex);
+    /** @brief Adds the cubes faces to the array of faces to be passed to the renderer
+    *@param A pointer to a cube object
+    *@param The integer index of the cubes position in the cube array
+    */
+    void moveCubes(Cube *cube);
+    /** @brief Translates the cube in the z axis towards the user (speed dependant on score) and left and right depending on the joystick location
+    *@param A pointer to a cube object
+    */
+    void displayDeathMenu();
+    /** @brief Displays the menu screen if the game has stopeed propting the user to either restart or go to the home menu
+    */
+    void deathButtonSelections();
+    /** @brief Determines the action to be taken depending on the button input once the game has ended
+    */
     void homeButtonSelections();
+    /** @brief Determines the action to be taken depending on the button input at the home screen
+    */
   public:
    Game();
    void run();
+    /** @brief Executes the game loop
+    */
    void homeScreen();
+    /** @brief Executed the home screen loop
+    */
 };
\ No newline at end of file