test 1 doc

Dependencies:   mbed Gamepad2

Committer:
joebarhouch
Date:
Wed May 27 07:48:27 2020 +0000
Revision:
14:58887d7e1072
Parent:
11:b3024ab59fa5
final

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joebarhouch 2:f22cb01c43bc 1 #ifndef PLAYER_H
joebarhouch 2:f22cb01c43bc 2 #define PLAYER_H
joebarhouch 2:f22cb01c43bc 3
joebarhouch 2:f22cb01c43bc 4 #include "mbed.h"
joebarhouch 2:f22cb01c43bc 5 #include "N5110.h"
joebarhouch 2:f22cb01c43bc 6 #include "Gamepad.h"
joebarhouch 2:f22cb01c43bc 7 #include "Bitmap.h"
joebarhouch 2:f22cb01c43bc 8
joebarhouch 14:58887d7e1072 9 #define GRAVITY 4
joebarhouch 2:f22cb01c43bc 10
joebarhouch 14:58887d7e1072 11 /** Player Class
joebarhouch 14:58887d7e1072 12 * @brief Class to control the player
joebarhouch 14:58887d7e1072 13 * @author Joe Barhouch
joebarhouch 14:58887d7e1072 14 * @author 201291584
joebarhouch 14:58887d7e1072 15 */
joebarhouch 2:f22cb01c43bc 16
joebarhouch 2:f22cb01c43bc 17
joebarhouch 2:f22cb01c43bc 18 class Player
joebarhouch 2:f22cb01c43bc 19 {
joebarhouch 2:f22cb01c43bc 20 public:
joebarhouch 14:58887d7e1072 21 /** Constructor */
joebarhouch 2:f22cb01c43bc 22 Player();
joebarhouch 14:58887d7e1072 23 /** Deconstructor */
joebarhouch 2:f22cb01c43bc 24 ~Player();
joebarhouch 14:58887d7e1072 25 /** initialise the player
joebarhouch 14:58887d7e1072 26 *@param inital X position
joebarhouch 14:58887d7e1072 27 *@param inital Y position
joebarhouch 14:58887d7e1072 28 */
joebarhouch 3:e4e1cbf750b6 29 void init(int x, int y);
joebarhouch 14:58887d7e1072 30 /** Draw on the lcd
joebarhouch 14:58887d7e1072 31 *@param lcd
joebarhouch 14:58887d7e1072 32 */
joebarhouch 2:f22cb01c43bc 33 void draw(N5110 &lcd);
joebarhouch 14:58887d7e1072 34 /** Update inputs
joebarhouch 14:58887d7e1072 35 *@param Direction d of the Joystick
joebarhouch 14:58887d7e1072 36 *@param Magnitude of joystick position
joebarhouch 14:58887d7e1072 37 *@param Y position of platforms
joebarhouch 14:58887d7e1072 38 *@param fall true if the player is falling
joebarhouch 14:58887d7e1072 39 *@param jump is true f player is jumping
joebarhouch 14:58887d7e1072 40 */
joebarhouch 7:530ca713d2b2 41 void update(Direction d, float mag, int Ypos, bool fall, bool jump);
joebarhouch 14:58887d7e1072 42 /** set position of enemies
joebarhouch 14:58887d7e1072 43 *@return Vector2D of the position
joebarhouch 14:58887d7e1072 44 */
joebarhouch 3:e4e1cbf750b6 45 Vector2D get_pos();
joebarhouch 8:d19b30a6cd69 46
joebarhouch 11:b3024ab59fa5 47
joebarhouch 14:58887d7e1072 48
joebarhouch 2:f22cb01c43bc 49 private:
joebarhouch 2:f22cb01c43bc 50 int _vx;
joebarhouch 2:f22cb01c43bc 51 int _vy;
joebarhouch 2:f22cb01c43bc 52 int _playerX;
joebarhouch 2:f22cb01c43bc 53 int _playerY;
joebarhouch 5:928c2eee4109 54 bool _floorCollision;
joebarhouch 8:d19b30a6cd69 55 char _dir;
joebarhouch 8:d19b30a6cd69 56 Timer t;
joebarhouch 9:9830d3a78572 57 bool f;
joebarhouch 14:58887d7e1072 58
joebarhouch 2:f22cb01c43bc 59 };
joebarhouch 14:58887d7e1072 60
joebarhouch 2:f22cb01c43bc 61 #endif