Description
In this stage, you will implement the new game function and the game stats.
You need to store important variables when creating a new game such as:
- The username. You will need it in a later stage for the save file path.
- The character attributes:
Name,Species, and theGender. - The inventory:
Snack,Weapon, andTool. - The difficulty level:
1. Easy,2. Mediumand3. Hard. The user should be able to select the difficulty level either by the word or the index. Difficulty selection should be case-insensitive. - The remaining lives: 5 for an easy difficulty level, 3 for a medium one, and 1 for a hard one. You don't need to take the number of lives as input, it should be calculated on the basis of the level that the user chooses.
You might want to divide variables into sections to make the output more pleasing to the player, that won't be tested.
Output highlighted substrings from a list before corresponding input, so that player can determine what data he/she is entering. You should get the game variables in the same order as in the Examples section.
When all the variables have been entered your program should output the game stats. You can use the following formatting:
Good luck on your journey, {username}!
Your character: {name}, {species}, {gender}
Your inventory: {snack}, {weapon}, {tool}
Difficulty: {difficulty}
Number of lives: {lives}
Note, that difficulty level should be printed as a word (Easy, Medium or Hard)
Also, a player can make a mistake by choosing to create a new game, so give them an option to go back to the main menu: Enter a username ('/b' to go back):.
Don't forget to handle incorrect input of difficulty the same way as before with option selection!
Objectives
In this stage, your program should:
- Create and store the game state with variables such as the inventory, character attributes, difficulty, remaining lives, and the username.
- Have the option to go back to the menu with
/bcommand before creating a new game. - Before the new game starts, output the message
Good luck on your journey, {username}!with the game stats below such as the character traits, inventory, difficulty, and the number of lives. - Handle incorrect input of difficulty.
Examples
The greater-than symbol followed by a space (> ) represents the user input. Note that it's not part of the input.
Example 1: creating a new game.
***Welcome to the Journey to Mount Qaf***
1. Start a new game (START)
2. Load your progress (LOAD)
3. Quit the game (QUIT)
> 1
Starting a new game...
Enter a username ('/b' to go back): > new_user
Create your character:
Name: > john
Species: > human
Gender: > male
Pack your bag for the journey:
Snack: > apple
Weapon: > sword
Tool: > rope
Choose your difficulty:
1. Easy
2. Medium
3. Hard
> 1
Good luck on your journey, new_user!
Your character: john, human, male
Your inventory: apple, sword, rope
Difficulty: easy
Number of lives: 5
Example 2: unknown input.
...
Choose your difficulty:
1. Easy
2. Medium
3. Hard
> insane
Unknown input! Please enter a valid one.
> easy
...
Example 3: going back to the menu.
***Welcome to the Journey to Mount Qaf***
1. Start a new game (START)
2. Load your progress (LOAD)
3. Quit the game (QUIT)
> 1
Starting a new game...
Enter a username ('/b' to go back): > /b
***Welcome to the Journey to Mount Qaf***
1. Start a new game (START)
2. Load your progress (LOAD)
3. Quit the game (QUIT)
...