Adding Stairs to the Map

Staircases provide a popular means of conveyance to deeper levels. Stairs can occupy a single tile, are relatively easy to render, and are intuitive. In this section, you’ll define stairs as a new type of map tile. You’ll add stairs to your map rendering and theming system, and update the navigation system to allow the player to enter the staircase. Rather than spawn the Amulet of Yala at the end of each level, you’ll only add it to the last level—the other levels will feature an exit to the next dungeon layer.

Let’s start by adding the staircase to the game map.

Making and Rendering Staircases

To render staircases within your dungeon, you’ll need a new type of map tile. Open map.rs and find the TileType enumeration. ...

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.