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:
- 24:7770c7f27cdc
- Parent:
- 23:5e8a435e568f
- Child:
- 25:1d3bf74dddeb
--- a/Game/Game.h Thu May 09 12:15:50 2019 +0000
+++ b/Game/Game.h Thu May 09 12:46:52 2019 +0000
@@ -11,22 +11,79 @@
#include "Enemy2.h"
#include "Coin.h"
+/** Game class
+
+@brief Class of all game functions called in main.cpp
+
+@version 1.0
+
+@author Spencer Tingle
+
+@date 09/05/19
+
+*/
+
class Game{
public:
Game();
~Game();
+ /**
+ * @brief Initiates coordinates of sprites and values
+ */
void init();
- int get_lives();
+ /**
+ * @brief Gets current health
+ * @details Health set intially to 10
+ */
+ int get_health();
+ /**
+ * @brief Gets current direction of joystick
+ */
void direc(Gamepad &pad);
+ /**
+ * @brief Displays current health
+ * @param N5110 &lcd @details Health displayed in bottom left corner of lcd
+ */
void display_health(N5110 &lcd);
+ /**
+ * @brief Draws all sprites
+ * @param N5110 &lcd @details Draws sprites at coordinates specified in init()
+ */
void drawSprite(N5110 &lcd);
+ /**
+ * @brief Move sprites
+ * @param N5110 &lcd @details Allows for movement of player and enemies
+ */
void movement(N5110 &lcd, Gamepad &pad);
+ /**
+ * @brief Detects collection
+ * @param N5110 &lcd, Gamepad &pad
+ * @details If coin is collected then it will respawn in new game
+ */
void collect(N5110 &lcd, Gamepad &pad);
+ /**
+ * @brief Win screen
+ * @param N5110 &lcd @details If win condition met win screen displays
+ */
void win(N5110 &lcd);
+ /**
+ * @brief Detects damage
+ * @param N5110 &lcd, Gamepad &pad
+ * @details If win condition met win screen displays
+ */
void damage(N5110 &lcd, Gamepad &pad);
+ /**
+ * @brief Death screen
+ * @param N5110 &lcd @details If death condition met game over screen displays
+ */
void death(N5110 &lcd);
+ /**
+ * @brief User Interface
+ * @param N5110 &lcd, Gamepad &pad
+ * @details Displays menus on start-up and game over
+ */
void UI(N5110 &lcd, Gamepad &pad);
private:
@@ -59,7 +116,7 @@
int x;
int y;
- int _lives;
+ int _health;
int coin;
};