June 2021
Beginner
344 pages
8h 9m
English
The adventurer is the player’s avatar in the dungeon. The player roams the dungeon, hopefully collecting loot and probably dying at the hands of vicious monsters. The game needs to know what tiles the adventurers can enter so they don’t walk through walls. It also needs to store where the player is, handle moving them with the keyboard, and perform the movement. This section will address each of these requirements.
Let’s add some more map functions to support player functionality. You need to determine if an x/y coordinate pair is within the bounds of the map. If you don’t perform bounds-checking, the player can move off the edge of the map, and either wrap around or crash the program. Add the following ...
Read now
Unlock full access