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: Gameengine/Gameengine.h
- Revision:
- 49:9bea7089b657
- Parent:
- 48:bd1f31fbfee3
- Child:
- 56:8c827d1cae3b
--- a/Gameengine/Gameengine.h Wed Apr 24 15:20:01 2019 +0000
+++ b/Gameengine/Gameengine.h Wed Apr 24 16:45:47 2019 +0000
@@ -20,106 +20,109 @@
{
public:
-
+ /** constructor
+ */
Gameengine();
+ /** deconstructor
+ */
~Gameengine();
- /** Initialises all default game settings.
- * @details Sets player starting position, number of lives, level start and timer.
- */
+ /** 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.
- * @details Contains all functions that update player position and game conditions
- such as lives left, timer, game over and level complete.
- */
+ /** 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);
- /** 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);
- /** 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);
- /** 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.
- */
+ /**
+ * @brief Reads direction the player is moving.
+ * @details Uses getdirection() function from Gamepad library.
+ */
void read_direction(Gamepad &pad);
- /** Calculates lives remaining.
- * @returns integer calue to control lives fsm state in leds() main.cpp
- */
+ /** Calculates lives remaining.
+ * @returns integer calue to control lives fsm state in leds() main.cpp
+ */
+ int lives_leds();
+ /** 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
+ */
int oxygen_leds();
- /** 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
- */
- int lives_leds();
- /**
- * @brief Calculates and displays player score.
- * @details At game over or game completed the players score is calculated and
- * displayed. It takes time remaining and multiplies this by lives remaining, then
- * adds on 10 points for every key collected.
- */
+ /**
+ * @brief Calculates and displays player score.
+ * @details At game over or game completed the players score is calculated and
+ * displayed. It takes time remaining and multiplies this by lives remaining, then
+ * adds on 10 points for every key collected.
+ */
void get_score(N5110 &lcd);
-/** Returns true if game completed.
- * @details calculates when _level variable has gone beyond number of levels in game.
- * @return true if game complete
- */
+ /** 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);
- /** 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.
- */
+ /** 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.
+ */
void lose_life(Gamepad &pad, N5110 &lcd);
- /** States whether game over condition met
- * @return returns true if game over.
- */
+ /** States whether game over condition met
+ * @return returns true if game over.
+ */
bool game_over();
- /** Returns true when player at exit.
- * @return 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);
- /** 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.
- * 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 will be drawn, keys needed increased by 5 and miner position reset.
- */
+ /** 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.
+ * 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 will be drawn, keys needed increased by 5 and miner position reset.
+ */
void next_level(N5110 &lcd);
- /** 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.
- */
+ /** 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);
- /** 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.
- */
+ /** 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);
- /** 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.
- */
+ /** Sets all block positions and collision rules.
+ * @details Function sets all block positons and collision rules stated in
+ * Sprites class. Blocks 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. Int i is set _level
+ * so function knows which level settings to use.
+ */
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
-
- */
+ /** 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.
+ * @return true if player collides with enemy.
+ */
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().
-
- */
+ /** 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: