Movement + Directions


Just like with the rooms the original plan was to use enums for the movement, but this was changed to now using a 2D array, the array has 1 place within the array for the room which it is in relation to, then it has another for the 4 different directs the player can go in,  using this i am able to tell the player what directions they can go in, as the ones which are available will be accessible to another room, which is it moves in that direction will be forwarded to that position on the map, then for walls or other blocking objects, the array for that direction has the value of -1 , so they are unable to go that direction as they cannot be moved to anywhere else in the map as no-where has the value of -1 on the map.


As more of a visual aid to the player, the directions are constantly rendered to the screen and the code checks to see if the room you are in is able to go in each direction if the value of that direction is -1 in the array, then the colour of the text for that direction is red to symbolise you cannot go that way, if its fine to move the colour for the direction is then instead green.



For some locations the path is blocked unless you have a specific item, in those cases in the main.cpp it checks if the user has that item and if they do allows them to go in that direction, where-as if they don't have the item it is treated like a normal wall where the player is not able to go in that direction


Leave a comment

Log in with itch.io to leave a comment.