Josh Davy / Mbed 2 deprecated Flip

Dependencies:   mbed el17jd

Committer:
joshdavy
Date:
Wed May 08 14:41:56 2019 +0000
Revision:
14:1e6f74233e8e
Parent:
10:58cf89dd878c
Documentation test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joshdavy 3:b34685dbdb8d 1 #ifndef PLAYER_H
joshdavy 3:b34685dbdb8d 2 #define PLAYER_H
joshdavy 3:b34685dbdb8d 3
joshdavy 3:b34685dbdb8d 4 #include "mbed.h"
joshdavy 3:b34685dbdb8d 5 #include "N5110.h"
joshdavy 3:b34685dbdb8d 6 #include "Gamepad.h"
joshdavy 3:b34685dbdb8d 7 #include "Bitmap.h"
joshdavy 3:b34685dbdb8d 8 #include "Sprite.h"
joshdavy 7:68e06dda79f7 9 #include "Level.h"
joshdavy 8:21b6d4dbce44 10 #include "PlayerMap.h"
joshdavy 3:b34685dbdb8d 11
joshdavy 3:b34685dbdb8d 12 #define GRAVITY 2
joshdavy 10:58cf89dd878c 13 #define PLAYER_HEIGHT 6
joshdavy 10:58cf89dd878c 14 #define PLAYER_WIDTH 6
joshdavy 10:58cf89dd878c 15 #define SPEED 2
joshdavy 14:1e6f74233e8e 16 /** Player Class
joshdavy 14:1e6f74233e8e 17
joshdavy 14:1e6f74233e8e 18 @brief Player Class handles the updating,location and collision detection of the
joshdavy 14:1e6f74233e8e 19 player as well as rendering the player on screen depending on the current
joshdavy 14:1e6f74233e8e 20 orientation.
joshdavy 14:1e6f74233e8e 21 @version 1.0
joshdavy 14:1e6f74233e8e 22
joshdavy 14:1e6f74233e8e 23 @author Joshua Davy el17jd
joshdavy 14:1e6f74233e8e 24
joshdavy 14:1e6f74233e8e 25 @date April 2019
joshdavy 14:1e6f74233e8e 26
joshdavy 14:1e6f74233e8e 27 */
joshdavy 14:1e6f74233e8e 28
joshdavy 3:b34685dbdb8d 29
joshdavy 3:b34685dbdb8d 30
joshdavy 3:b34685dbdb8d 31 class Player : public Sprite{
joshdavy 3:b34685dbdb8d 32
joshdavy 3:b34685dbdb8d 33 public:
joshdavy 3:b34685dbdb8d 34 Player();
joshdavy 3:b34685dbdb8d 35 ~Player();
joshdavy 7:68e06dda79f7 36 void update(Gamepad &pad, Block blocks [],int number_of_blocks);
joshdavy 10:58cf89dd878c 37 void init(Vector2D pos);
joshdavy 14:1e6f74233e8e 38 bool check_goal_reached(Vector2D goal);
joshdavy 8:21b6d4dbce44 39
joshdavy 14:1e6f74233e8e 40
joshdavy 14:1e6f74233e8e 41
joshdavy 14:1e6f74233e8e 42 private:
joshdavy 9:96969b1c6bde 43 void check_out_of_range();
joshdavy 14:1e6f74233e8e 44
joshdavy 10:58cf89dd878c 45 void update_sprite(int orientation,int direction);
joshdavy 10:58cf89dd878c 46 void process_inputs(Gamepad &pad,
joshdavy 10:58cf89dd878c 47 Block blocks [], int number_of_blocks);
joshdavy 10:58cf89dd878c 48 void gravity(Block blocks [], int number_of_blocks);
joshdavy 9:96969b1c6bde 49
joshdavy 8:21b6d4dbce44 50 bool can_move_up(Block blocks [],int number_of_blocks);
joshdavy 8:21b6d4dbce44 51 bool can_move_down(Block blocks [],int number_of_blocks);
joshdavy 8:21b6d4dbce44 52 bool can_move_left(Block blocks [],int number_of_blocks);
joshdavy 8:21b6d4dbce44 53 bool can_move_right(Block blocks [],int number_of_blocks);
joshdavy 7:68e06dda79f7 54
joshdavy 10:58cf89dd878c 55
joshdavy 7:68e06dda79f7 56 int _orientation;
joshdavy 8:21b6d4dbce44 57 int _direction;
joshdavy 9:96969b1c6bde 58 Vector2D _initial_pos;
joshdavy 3:b34685dbdb8d 59 };
joshdavy 3:b34685dbdb8d 60
joshdavy 3:b34685dbdb8d 61 #endif