|
| 1 | +# Text-Based Adventure Game |
| 2 | + |
| 3 | +Welcome to the **Text-Based Adventure Game**! This Python game is a simple interactive adventure where players explore rooms, collect items, and engage in combat with opponents like goblins and dragons. Each decision you make will affect your inventory and how you handle future challenges. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Two distinct types of doors**: Players can choose between doors, which may lead to hidden items such as swords or shields. |
| 8 | +- **Combat System**: Engage in battle with different opponents: |
| 9 | + - **Goblin**: A weak opponent that requires strategy. |
| 10 | + - **Dragon**: A formidable final boss with special attacks. |
| 11 | +- **Inventory Management**: Pick up and use items like swords and shields to aid in combat. |
| 12 | +- **Game Save & Load**: Your progress is automatically saved, so you can load it later and continue from where you left off. |
| 13 | + |
| 14 | +## Gameplay |
| 15 | + |
| 16 | +- Players start the game by entering their name. |
| 17 | +- You are presented with two doors to choose from, each leading to different experiences. |
| 18 | +- Items like swords and shields can be found to help you in combat. |
| 19 | +- Random encounters with goblins and dragons will test your decision-making skills. |
| 20 | +- The game automatically saves your progress, allowing you to resume your adventure later. |
| 21 | + |
| 22 | +## How to Play |
| 23 | + |
| 24 | +1. **Choose a door**: When prompted, choose either the left or right door. Each door may contain hidden treasures like a sword or shield. |
| 25 | +2. **Make choices**: Decide whether to pick up items or face challenges. |
| 26 | +3. **Combat**: Engage in combat with either a goblin or dragon. Use your sword and shield to protect yourself or defeat enemies. |
| 27 | +4. **Save your progress**: The game will automatically save after each major action. |
| 28 | +5. **Reload your game**: If you exit the game, you can load it from the last saved point when you return. |
| 29 | + |
| 30 | +## Setup and Installation |
| 31 | + |
| 32 | +1. Ensure you have Python 3 installed on your machine. |
| 33 | +2. Clone this repository to your local machine. |
| 34 | +3. Navigate to the project directory. |
| 35 | +4. Run the text_adventure_game. |
| 36 | + |
| 37 | + |
| 38 | +## Code Overview |
| 39 | + |
| 40 | +The game is built using Python, and its logic is divided into several components: |
| 41 | + |
| 42 | +- **Opponent Class**: The base class for both weak and strong opponents. Handles basic attack logic. |
| 43 | +- **WeakOpponent Class**: A class for weaker opponents like the goblin. Overrides the attack method to reflect weaker attacks. |
| 44 | +- **FinalBoss Class**: A subclass of Opponent designed for more challenging enemies like the dragon, with special powers. |
| 45 | +- **Combat and Exploration**: Players can choose doors, explore rooms, collect items, and engage in combat. |
| 46 | +- **Saving and Loading**: The game state is saved to a file (`game_save.txt`), and players can load this file to continue their progress. |
| 47 | + |
| 48 | +## Error Handling |
| 49 | + |
| 50 | +The game is designed with basic error handling using `try-except` blocks: |
| 51 | +- If there are issues with file saving or loading, an error message is displayed. |
| 52 | +- Combat logic is wrapped in error handling to prevent crashes due to unexpected input. |
| 53 | + |
| 54 | +Enjoy your adventure! |
0 commit comments