Chapter 5. Raspi’s Cave Adventure
- Drawing flow diagrams to map out complex programs
- Using Boolean operators to check input from users
- Making code for multiple choices using if, elif, and else statements
- Creating and using your own functions to organize code and avoid repeating code
- Nesting if/else statements to create games with complex logic
Like a great book, a game can create an entire imaginary world in your mind. One of the most exciting aspects of games is when you feel like you’re inside the game. This doesn’t require virtual-reality goggles or high-definition graphics. You can create this immersive feeling even in a completely text-based game by connecting with the player’s imagination and creating a world where they can make decisions and determine their own fate. To create games with imaginary worlds, you often have to generate a sense of depth by having the user move from room to room or scene to scene. The game should allow the user to choose their own path and introduce elements of surprise. Finally, you should also have some great descriptions that make the player feel like they’re in the room.
In this chapter, you’ll create just such a game, based on exploring an underground cavern. Along the way, the player will have to make choices, and if they make a wrong decision, the game is over. If they make the right decision, they’ll find untold treasures of gold, rubies, and diamonds!