The game is finished

Dependencies:   mbed Gamepad N5110 mbed-rtos

Committer:
RexRoshan
Date:
Thu May 09 14:23:35 2019 +0000
Revision:
14:c7302ffe6eab
Parent:
6:1fcfd331c047
Final Modification

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RexRoshan 0:99fa5a619081 1 #ifndef SPACECRAFT_H
RexRoshan 0:99fa5a619081 2 #define SPACECRAFT_H
RexRoshan 0:99fa5a619081 3
RexRoshan 0:99fa5a619081 4 #include "mbed.h"
RexRoshan 0:99fa5a619081 5 #include "N5110.h"
RexRoshan 0:99fa5a619081 6 #include "Gamepad.h"
RexRoshan 0:99fa5a619081 7
RexRoshan 6:1fcfd331c047 8 /** Spacecraft Class
RexRoshan 6:1fcfd331c047 9 * @brief Player's spacecraft
RexRoshan 6:1fcfd331c047 10 * @author Rex Roshan Raj
RexRoshan 6:1fcfd331c047 11 */
RexRoshan 0:99fa5a619081 12 class Spacecraft
RexRoshan 0:99fa5a619081 13 {
RexRoshan 0:99fa5a619081 14
RexRoshan 0:99fa5a619081 15 public:
RexRoshan 6:1fcfd331c047 16
RexRoshan 6:1fcfd331c047 17 /** Constructor */
RexRoshan 0:99fa5a619081 18 Spacecraft();
RexRoshan 6:1fcfd331c047 19
RexRoshan 6:1fcfd331c047 20 /** Destructor */
RexRoshan 0:99fa5a619081 21 ~Spacecraft();
RexRoshan 0:99fa5a619081 22
RexRoshan 6:1fcfd331c047 23 /** Initialise the parameters for the player's spacecraft
RexRoshan 6:1fcfd331c047 24 *@param a - x position of the enemy
RexRoshan 6:1fcfd331c047 25 *@param b - y position of the enemy
RexRoshan 6:1fcfd331c047 26 */
RexRoshan 0:99fa5a619081 27 void init(int x,int y);
RexRoshan 6:1fcfd331c047 28
RexRoshan 6:1fcfd331c047 29 /** Draws the player's spacecraft
RexRoshan 6:1fcfd331c047 30 * @param N5110 lcd
RexRoshan 6:1fcfd331c047 31 */
RexRoshan 0:99fa5a619081 32 void character(N5110 &lcd);
RexRoshan 6:1fcfd331c047 33
RexRoshan 6:1fcfd331c047 34 /** Updates the direction
RexRoshan 6:1fcfd331c047 35 * @param Direction d - the direction the player moves using joystick
RexRoshan 6:1fcfd331c047 36 * @param mag - magnitude of the how fast the player moves
RexRoshan 6:1fcfd331c047 37 * @brief Changes the direction based on the position of the joystick
RexRoshan 6:1fcfd331c047 38 */
RexRoshan 0:99fa5a619081 39 void update(Direction d,float mag);
RexRoshan 6:1fcfd331c047 40
RexRoshan 6:1fcfd331c047 41 /** Updates move
RexRoshan 6:1fcfd331c047 42 * @brief Moves the spacecraft down when the player dies
RexRoshan 6:1fcfd331c047 43 */
RexRoshan 0:99fa5a619081 44 void update_move();
RexRoshan 6:1fcfd331c047 45
RexRoshan 6:1fcfd331c047 46 /** Adds the value of health by 1 */
RexRoshan 0:99fa5a619081 47 void add_health();
RexRoshan 6:1fcfd331c047 48
RexRoshan 6:1fcfd331c047 49 /** Gets the value of the health
RexRoshan 6:1fcfd331c047 50 * @returns value in range 0 to 6
RexRoshan 6:1fcfd331c047 51 */
RexRoshan 0:99fa5a619081 52 int get_health();
RexRoshan 6:1fcfd331c047 53
RexRoshan 6:1fcfd331c047 54 /** Gets the position of the player's spacecraft
RexRoshan 6:1fcfd331c047 55 * @returns a struct with x,y members which corresponds to x and y position respectively
RexRoshan 6:1fcfd331c047 56 */
RexRoshan 0:99fa5a619081 57 Vector2D get_pos();
RexRoshan 0:99fa5a619081 58
RexRoshan 0:99fa5a619081 59 private:
RexRoshan 0:99fa5a619081 60
RexRoshan 0:99fa5a619081 61 int _x;
RexRoshan 0:99fa5a619081 62 int _y;
RexRoshan 0:99fa5a619081 63 int _speed;
RexRoshan 0:99fa5a619081 64 int _health;
RexRoshan 0:99fa5a619081 65 int _increment;
RexRoshan 0:99fa5a619081 66
RexRoshan 0:99fa5a619081 67 };
RexRoshan 0:99fa5a619081 68
RexRoshan 0:99fa5a619081 69 #endif