This project is the result of a Code First Girls task, with the open-ended challenge of creating a game using an API.
I chose to use a Harry Potter API to create a spell casting battle game against a computer opponent. Players begin with 100 health and cast either damage or healing spells, with the goal of reducing your opponent’s health to 0.
✨ Text input for character selection via API
✨ Houses have ‘special powers’ with damage/healing modifications
✨ Random spell chosen via a different API based on healing or damage selection
✨ Text interface embellishments
✨ Filtered text input to assist user experience
✨ Modular functions for code efficiency
- Python 3.9.13^
- Requests installed
- Colorama installed
-
Clone the repository to your desired location
git clone https://github.com/Cinzia-I-M/harry-potter-battle-game.git
-
Enter the repository directory via command line
cd harry-potter-battle-game
-
Run the script
python harrypotter.py
-
Enjoy playing!
- First you can choose if you would like to pick your team or if you want a random team.
- If you choose to pick your team, you can select three characters from Harry Potter by typing all or part of their names.
- Depending on which house your characters are in, you will get special powers that either increase or decrease your damage and healing powers.
- The computer selects a random team.
- Then you start the battle! Pick a damage spell to start. This will harm the computer's health.
- The computer then picks either a damage or healing spell.
- This goes on until one of you reaches 0 health.
- Beware of Avada Kedavra (The Killing Curse) as this will kill instantly! 🐍
- At the end you can choose to play again or not.