Project Submission (late)

Dependencies:   mbed

Committer:
el17tc
Date:
Fri May 10 14:52:28 2019 +0000
Revision:
3:83e79d31930c
Parent:
0:72f372170a73
final commit, API is added.; I'm not sure if there is a specific statement of academic integrity wanted but- I declare that this work is 100% my own, I have not plagiarised any work or attempted to fabricate any part of it for extra marks.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el17tc 0:72f372170a73 1 #ifndef PLAYER_H
el17tc 0:72f372170a73 2 #define PLAYER_H
el17tc 0:72f372170a73 3
el17tc 0:72f372170a73 4 #include "Maze.h"
el17tc 0:72f372170a73 5 #include "Vector2Di.h"
el17tc 0:72f372170a73 6
el17tc 3:83e79d31930c 7 /** Player Class
el17tc 3:83e79d31930c 8 * @brief This class exists to store information about the player's location in the maze.
el17tc 3:83e79d31930c 9 * @brief more specifically, it stores their coordinates and their direction, both as vectors.
el17tc 3:83e79d31930c 10 * @brief It also facilitates the player's control of the camera via the gamepad.
el17tc 3:83e79d31930c 11 *
el17tc 3:83e79d31930c 12 * @brief Version 1.0
el17tc 3:83e79d31930c 13 * @author Thomas Caine
el17tc 3:83e79d31930c 14 * @date May 2019
el17tc 3:83e79d31930c 15 */
el17tc 0:72f372170a73 16 class Player {
el17tc 0:72f372170a73 17
el17tc 0:72f372170a73 18 public:
el17tc 3:83e79d31930c 19 /** Create a Player object
el17tc 3:83e79d31930c 20 * @param maze - a maze object so the Player class has access to the maze matrix
el17tc 3:83e79d31930c 21 * @details This constructor does not set the player's position (not to the desired position anyway).
el17tc 3:83e79d31930c 22 * @details The player's proper position is assigned after the Player object's initial creation.
el17tc 3:83e79d31930c 23 */
el17tc 0:72f372170a73 24 Player(Maze* maze);
el17tc 3:83e79d31930c 25 /** Check's the value of the cell in a specified direction from the current cell.
el17tc 3:83e79d31930c 26 * @param origin - vector of the co-ordinates to check from. Not necessarily the Player's current position.
el17tc 3:83e79d31930c 27 * @param angle - double representing the angle to rotate by before checking in front, will always be a multiple of PI/2.
el17tc 3:83e79d31930c 28 * @param checkVal - integer, checkLocation returns true if the checked cell has this value.
el17tc 3:83e79d31930c 29 */
el17tc 0:72f372170a73 30 bool checkLocation(Vector2Di origin, double angle, int checkVal);
el17tc 3:83e79d31930c 31 /** Move the player's position forward one in their current direction.
el17tc 3:83e79d31930c 32 * Performs validity check first. Won't increment position if cell infront is solid (i.e. 1)
el17tc 3:83e79d31930c 33 */
el17tc 0:72f372170a73 34 void walk();
el17tc 3:83e79d31930c 35 /** Rotates the player's current direction by 90 degrees counter-clockwise.
el17tc 3:83e79d31930c 36 */
el17tc 0:72f372170a73 37 void turnLeft();
el17tc 3:83e79d31930c 38 /** Rotates the player's current direction by 90 degrees clockwise.
el17tc 3:83e79d31930c 39 */
el17tc 0:72f372170a73 40 void turnRight();
el17tc 3:83e79d31930c 41 /** Moves the player one cell backwards.
el17tc 3:83e79d31930c 42 * Will not work if the cell behind the player is not open.
el17tc 3:83e79d31930c 43 */
el17tc 0:72f372170a73 44 void stepBack();
el17tc 0:72f372170a73 45
el17tc 0:72f372170a73 46 Vector2Di pos;
el17tc 0:72f372170a73 47 Vector2Di direction;
el17tc 0:72f372170a73 48 Maze* maze;
el17tc 0:72f372170a73 49
el17tc 0:72f372170a73 50 };
el17tc 0:72f372170a73 51
el17tc 0:72f372170a73 52 #endif // PLAYER_H