ELEC2645 (2018/19) / Mbed 2 deprecated ll16o2l_ELEC2645

Dependencies:   mbed Gamepad

Committer:
ll16o2l
Date:
Tue May 07 18:01:54 2019 +0000
Revision:
15:807eba7c7811
Parent:
8:c3153fd4d8ce
Re-organised the documentation and finished the project.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ll16o2l 2:888634fff8ff 1 #ifndef PLAYER_H
ll16o2l 2:888634fff8ff 2 #define PLAYER_H
ll16o2l 2:888634fff8ff 3
ll16o2l 2:888634fff8ff 4 #include "mbed.h"
ll16o2l 2:888634fff8ff 5 #include "N5110.h"
ll16o2l 2:888634fff8ff 6 #include "Gamepad.h"
ll16o2l 8:c3153fd4d8ce 7
ll16o2l 8:c3153fd4d8ce 8 /** Player Class
ll16o2l 15:807eba7c7811 9
ll16o2l 15:807eba7c7811 10 @brief Controls the player in the Dodge game
ll16o2l 15:807eba7c7811 11
ll16o2l 15:807eba7c7811 12 @brief Revisions 1.0
ll16o2l 15:807eba7c7811 13
ll16o2l 15:807eba7c7811 14
ll16o2l 15:807eba7c7811 15 @author Oliver Luong, University of Leeds
ll16o2l 15:807eba7c7811 16 @date 22/04/2019
ll16o2l 3:aa82968b7a8e 17 */
ll16o2l 2:888634fff8ff 18 class Player
ll16o2l 2:888634fff8ff 19 {
ll16o2l 2:888634fff8ff 20 public:
ll16o2l 15:807eba7c7811 21 /** Contructor / Destructor */
ll16o2l 2:888634fff8ff 22 Player();
ll16o2l 2:888634fff8ff 23 ~Player();
ll16o2l 15:807eba7c7811 24
ll16o2l 15:807eba7c7811 25 // Methods
ll16o2l 15:807eba7c7811 26 /**
ll16o2l 15:807eba7c7811 27 This method will be used to initialise the player variables.
ll16o2l 15:807eba7c7811 28 Saves global variable values to local variables.
ll16o2l 15:807eba7c7811 29 @param player_height fetched from dodge engine.
ll16o2l 15:807eba7c7811 30 @param player_width ftechedd from dodge engine.
ll16o2l 15:807eba7c7811 31 */
ll16o2l 2:888634fff8ff 32 void init(int player_height,int player_width);
ll16o2l 15:807eba7c7811 33
ll16o2l 15:807eba7c7811 34 /**
ll16o2l 15:807eba7c7811 35 This method will be used to store the sprite for player and draw it
ll16o2l 15:807eba7c7811 36 onto the LCD.
ll16o2l 15:807eba7c7811 37 */
ll16o2l 2:888634fff8ff 38 void draw(N5110 &lcd);
ll16o2l 15:807eba7c7811 39
ll16o2l 15:807eba7c7811 40 /**
ll16o2l 15:807eba7c7811 41 This method will be used to update the positioning of
ll16o2l 15:807eba7c7811 42 the player in one of 8 directions.
ll16o2l 15:807eba7c7811 43 @param d fectches the direction of thhe joystick from dodge engine.
ll16o2l 15:807eba7c7811 44 @param mag fetches the magintude of the joystick from dodge engine.
ll16o2l 15:807eba7c7811 45 */
ll16o2l 3:aa82968b7a8e 46 void update(Direction d, float mag);
ll16o2l 15:807eba7c7811 47
ll16o2l 15:807eba7c7811 48 /**
ll16o2l 15:807eba7c7811 49 This method will be used to save the position of the player into p and retuns the position of the player.
ll16o2l 15:807eba7c7811 50 */
ll16o2l 2:888634fff8ff 51 Vector2D get_pos();
ll16o2l 2:888634fff8ff 52
ll16o2l 2:888634fff8ff 53 private:
ll16o2l 15:807eba7c7811 54 // Variables
ll16o2l 2:888634fff8ff 55 int _player_height;
ll16o2l 2:888634fff8ff 56 int _player_width;
ll16o2l 2:888634fff8ff 57 int _x;
ll16o2l 2:888634fff8ff 58 int _y;
ll16o2l 2:888634fff8ff 59 int _speed;
ll16o2l 2:888634fff8ff 60
ll16o2l 2:888634fff8ff 61 };
ll16o2l 2:888634fff8ff 62 #endif