ELEC2645 (2018/19) / Mbed 2 deprecated el17ntkv

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Badengine.h Source File

Badengine.h

00001 #ifndef BADENGINE_H
00002 #define BADENGINE_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Badman.h"
00008 #include "Grid.h"
00009 #include "ScreenArray.h"
00010 
00011 
00012 
00013 /** Badengine Class
00014 @author Mr Nigel TK Vere, University of Leeds
00015 @brief Badengine controls the operation of the game per level using the charactersprites,grid,ghost and badman classes
00016 @date April 2019
00017 */
00018 
00019 /** Badengine Class
00020 
00021 @brief Badengine controls the operation of the game per level using the charactersprites,grid,ghost and badman classes
00022 
00023 @version 1.0
00024 
00025 @author Mr Nigel TK Vere
00026 
00027 @date April 2019
00028 
00029 
00030 */
00031 class Badengine
00032 {
00033 
00034 public:
00035     /**
00036     * @brief Default Badengine object constructor
00037 
00038     */
00039     Badengine();
00040     /**
00041     * @brief Default Badengine object destructor
00042 
00043     */
00044     ~Badengine();
00045     /**
00046       * @brief Mutator method initialises the badengine  object by initialising the respective charactersprites,grid,ghost and badman classes used in the game
00047 
00048       */
00049     void init();
00050     /**
00051     * @brief Mutator method records the users interactions with the badman character based on the joystick movement
00052 
00053     */
00054     void readInput(Gamepad &pad);
00055     /**
00056     * @brief Mutator method sets the number of ghosts being used at the respective point in time within the game
00057     * @param number @details Integer value representing the number of ghosts that will appear within the game
00058     */
00059     void setGhostNumber(int number);
00060     /**
00061     * @brief Mutator method updates the game accordingly depending on the users choice of movement
00062     * @param pad @details Refrence Gamepad object
00063     */
00064     void update(Gamepad &pad);
00065     /**
00066     * @brief Mutator method  displays the entire game  on the lcd screen
00067     * @param lcd @details Refrence NOKIA 5110 LCD screen object
00068     */
00069     void draw(N5110 &lcd);
00070     /* @brief Accessor method gets the status of the game in the case that all the fruit have been eaten by badman in the respective level
00071     @returns Returns the status(_status private variable  ) value of the badengine object
00072 
00073     */
00074     bool getStatus();
00075     /* @brief Accessor method gets the status of the game in terms of whether a collision between badman and a ghost has occured
00076     @returns Returns the ghost collision status(_ghoststatus private variable ) value of the badengine  object
00077 
00078     */
00079     bool getGhostStatus();
00080     
00081     /* @brief Accessor method gets the current score of the instance of the badengine currently running
00082     @returns Returns the score(_score private variable ) value of the badengine  object
00083 
00084     */
00085     int getScore();
00086 
00087 
00088 
00089 
00090 
00091 private:
00092     bool _status;//This boolean variable is used to denote whether the badman character has eaten all the fruit in the maze-true if no and false if yes
00093     bool _ghoststatus;//This boolean variable is used to denote whether any badman-ghost collisions have taken place-true if none and false if one has occured
00094     int _score;//The integer variable holds the total score for the current game inclusive of all level scores up to the point in time
00095     int checkCollision();//The check_collison accessor method returns the value of the next position in the grid's screen array value depending on badman's direction of movement at that point in time
00096     int ghostnumber;//The integer variable holds the number of ghosts being used at this respective call of the badengine object level
00097     Badman _baddest;//The badman object used in the game for gameplay
00098     Grid _grid;//The grid object used in the game to generate the maze
00099     ScreenArray _screen; //The screen array object used for collision detection
00100     Direction _d;//The direction variable that holds the direction that the badman object is moving towards dependent on the joysticks postion
00101 
00102 };
00103 
00104 #endif