Adding Spatial Memory
Whether the adventurer is unspooling thread as they work through a minotaur’s labyrinth or scribbling a map as they explore, it’s reasonable to expect the adventurer has some memory of where they have been. It also gives the player valuable clues about which parts of the dungeon they haven’t explored yet—reducing player frustration. In this section, you’ll give the player a memory of where they’ve been—and learn to render areas they remember but aren’t currently visible.
Revealing the Map
Open map.rs. Add a new vector named revealed, containing the revealed status of each tile. If the player has seen the tile, the tile’s entry in revealed will be set to true. If they haven’t, it will be false. Create the new vector and ...
Get Hands-on Rust now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.