Project Submission (late)
Dependencies: mbed
Player.h
00001 #ifndef PLAYER_H 00002 #define PLAYER_H 00003 00004 #include "Maze.h" 00005 #include "Vector2Di.h" 00006 00007 /** Player Class 00008 * @brief This class exists to store information about the player's location in the maze. 00009 * @brief more specifically, it stores their coordinates and their direction, both as vectors. 00010 * @brief It also facilitates the player's control of the camera via the gamepad. 00011 * 00012 * @brief Version 1.0 00013 * @author Thomas Caine 00014 * @date May 2019 00015 */ 00016 class Player { 00017 00018 public: 00019 /** Create a Player object 00020 * @param maze - a maze object so the Player class has access to the maze matrix 00021 * @details This constructor does not set the player's position (not to the desired position anyway). 00022 * @details The player's proper position is assigned after the Player object's initial creation. 00023 */ 00024 Player(Maze* maze); 00025 /** Check's the value of the cell in a specified direction from the current cell. 00026 * @param origin - vector of the co-ordinates to check from. Not necessarily the Player's current position. 00027 * @param angle - double representing the angle to rotate by before checking in front, will always be a multiple of PI/2. 00028 * @param checkVal - integer, checkLocation returns true if the checked cell has this value. 00029 */ 00030 bool checkLocation(Vector2Di origin, double angle, int checkVal); 00031 /** Move the player's position forward one in their current direction. 00032 * Performs validity check first. Won't increment position if cell infront is solid (i.e. 1) 00033 */ 00034 void walk(); 00035 /** Rotates the player's current direction by 90 degrees counter-clockwise. 00036 */ 00037 void turnLeft(); 00038 /** Rotates the player's current direction by 90 degrees clockwise. 00039 */ 00040 void turnRight(); 00041 /** Moves the player one cell backwards. 00042 * Will not work if the cell behind the player is not open. 00043 */ 00044 void stepBack(); 00045 00046 Vector2Di pos; 00047 Vector2Di direction; 00048 Maze* maze; 00049 00050 }; 00051 00052 #endif // PLAYER_H
Generated on Thu Jul 14 2022 20:06:29 by 1.7.2