
Kaif Kutchwala 201267448 ELEC2645 Project
Dependencies: mbed
Game/Game.h
- Committer:
- KaifK
- Date:
- 2020-05-17
- Revision:
- 10:dbc149804a06
- Parent:
- 9:e6566d09f087
- Child:
- 12:ca7329a41fc5
File content as of revision 10:dbc149804a06:
#ifndef GAME_H #define GAME_H #include <cmath> #include <cstdlib> #include "mbed.h" #include "Gamepad.h" #include "N5110.h" #include "Ball.h" #include "Splash.h" class Game { private: //objects N5110 *_lcd; Gamepad *_pad; Ball *_ball; public: Game(N5110 &lcd, Gamepad &pad, Ball &ball); ~Game(); /** @brief initialise game values*/ void init(); /** @brief combines all other functions to form main gameplay loop)*/ void play(); /** @brief reads values user inputs i.e. direction and power (x and y)*/ void readInput(); /** @brief updates score on screen*/ void updateScore(); /** @brief updates number of lives on leds */ void updateLives(); /** @brief updates speed based on score */ void updateSpeed(); private: /** @brief takes pointer input for aim on x-axis */ void pointer_input(); /** @brief takes power input for aim on y-axis */ void power_meter_input(); /** @brief converts _x_val from pointer range (8-72) to screen range (0-84) */ void convert_to_shot_x(); /** @brief converts _y_val from power meter range (0-20) to goal range (0-24) */ void convert_to_shot_y(); /** @brief generates random value for given limit * @param limit @details sets max limit for random generator */ int random_level_gen(int limit); int _score; int _lives; float _x_val; float _y_val; int _shot_x; int _shot_y; float _speed; bool _is_goal; }; #endif