Tracking Game Level
Transitioning between levels is a great start—but it’s helpful to know what level the player is on. You need this information to determine if you should spawn the Amulet of Yala or an exit. You’ll use the current dungeon level to update the player with their progress through the dungeon. The current level will also be used in Chapter 15, Combat Systems and Loot, to spawn increasingly more challenging monsters and nicer loot as the adventurer progresses.
Let’s start by adding the current dungeon level to the Player component. The player is the only entity advancing through the dungeon, so the Player component is a good place to store the current map level. Open components.rs, and add a map_level field to the Player component: ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access