Project Submission (late)
Dependencies: mbed
Diff: Player/Player.cpp
- Revision:
- 3:83e79d31930c
- Parent:
- 0:72f372170a73
diff -r 43bb635db736 -r 83e79d31930c Player/Player.cpp --- a/Player/Player.cpp Fri May 10 10:51:19 2019 +0000 +++ b/Player/Player.cpp Fri May 10 14:52:28 2019 +0000 @@ -6,10 +6,18 @@ Player::Player(Maze* mazePtr) { maze = mazePtr; - pos = UP; - direction = DOWN; + pos = UP; // {0,1} is a temporary value to initialise the variable + direction = DOWN; // due to matrices index increasing as you go down + // and their acces being [row][column], the standard (x,y) co-ordinate system is + // effectively reversed so even though the direction is down, from our perspective + // (if we were looking down on the maze) it would be up. } +/* Function used to check the value of a cell in the maze from any given cell + (not necessarily the player's current position) + this function is used a lot in the Drawer (along with other information from the player) + so it is important the function is not bound to the player's current location +*/ bool Player::checkLocation(Vector2Di origin, double angle, int checkVal) { Vector2Di peekDirection = direction; peekDirection.rotateVector(angle);