ELEC2645 (2018/19) / Mbed 2 deprecated el17set_

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Game.h Source File

Game.h

00001 #ifndef GAME_H
00002 #define GAME_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Menu.h"
00008 #include "Baby.h"
00009 #include "Maze.h"
00010 #include "Enemy1.h"
00011 #include "Enemy2.h"
00012 #include "Coin.h"
00013 
00014 /** Game class
00015 
00016 @brief Class of all game functions called in main.cpp 
00017 
00018 @version 1.0
00019 
00020 @author Spencer Tingle
00021 
00022 @date 09/05/19
00023 
00024 */
00025 
00026 class Game{
00027 
00028  public:
00029 
00030   Game();
00031   ~Game();
00032   /** 
00033   * @brief Init
00034   * @details Initiates coordinates of sprites and values
00035   */
00036   void init();
00037   /** 
00038   * @brief Gets current health
00039   * @details Health set intially to 10
00040   */
00041   int get_health();
00042   /** 
00043   * @brief Gets current direction of joystick
00044   */
00045   void direc(Gamepad &pad);
00046    /** 
00047   * @brief Displays current health
00048   * @param N5110 &lcd @details Health displayed in bottom left corner of lcd
00049   */
00050   void display_health(N5110 &lcd);
00051    /** 
00052   * @brief Draws all sprites
00053   * @param N5110 &lcd @details Draws sprites at coordinates specified in init()
00054   */
00055   void drawSprite(N5110 &lcd);
00056    /** 
00057   * @brief Move sprites
00058   * @param N5110 &lcd @details Allows for movement of player and enemies
00059   */
00060   void movement(N5110 &lcd, Gamepad &pad);
00061    /** 
00062   * @brief Detects collection
00063   * @param N5110 &lcd, Gamepad &pad 
00064   * @details If coin is collected then it will respawn in new game
00065   */
00066   void collect(N5110 &lcd, Gamepad &pad);
00067    /** 
00068   * @brief Win screen
00069   * @param N5110 &lcd @details If win condition met win screen displays
00070   */
00071   void win(N5110 &lcd);
00072    /** 
00073   * @brief Detects damage
00074   * @param N5110 &lcd, Gamepad &pad  
00075   * @details If win condition met win screen displays
00076   */
00077   void damage(N5110 &lcd, Gamepad &pad);
00078    /** 
00079   * @brief Death screen
00080   * @param N5110 &lcd @details If death condition met game over screen displays
00081   */
00082   void death(N5110 &lcd);
00083    /** 
00084   * @brief User Interface
00085   * @param N5110 &lcd, Gamepad &pad  
00086   * @details Displays menus on start-up and game over
00087   */
00088   void UI(N5110 &lcd, Gamepad &pad);
00089 
00090  private:
00091 
00092   Baby baby;
00093   Maze maze;
00094   Menu menu;
00095   Direction dir;
00096 
00097   Enemy1 enemyA;
00098   Enemy1 enemy1;
00099   Enemy2 enemyB;
00100   Enemy2 enemy2;
00101   Enemy2 enemyC;
00102 
00103   Coin coin0;
00104   Coin coin1;
00105   Coin coin2;
00106   Coin coin3;
00107   Coin coin4;
00108   Coin coin5;
00109   Coin coin6;
00110   Coin coin7;
00111   Coin coin8;
00112   Coin coin9;
00113   Coin coin10;
00114   Coin coin11;
00115   Coin coin12;
00116   Coin coin13;
00117 
00118   int x;
00119   int y;
00120   int _health;
00121   int coin;
00122 };
00123 
00124 #endif