I just started Python Programming as a hobby recently. I was learning how to make a text-based game called Dragon Realm.
Basically it is a game where there are 2 caves, one with a friendly dragon that gives you treasure, and another cave with a hungry dragon that eats you. The game allows the player to choose a cave and randomly decides whether the player gets the treasure or gets eaten.
Here's the source code:
- Code: Select all
print('You are in a land full of dragons. In front of you,')
print('you see two caves. In one cave, the dragon is friendly')
print('and will share his treasure with you. The other dragon')
print('is greedy and hungry, and will eat you on sight.')
cave = ''
while cave != '1' and cave != '2':
print('Which cave will you go into? (1 or 2)')
cave = input()
print('You approach the cave...')
print('It is dark and spooky...')
print('A large dragon jumps out in front of you! He opens his jaws and...')
friendlyCave = random.randint(1, 2)
if chosenCave == str(friendlyCave):
print('Gives you his treasure!')
print('Gobbles you down in one bite!')
playAgain = 'yes'
while playAgain == 'yes' or playAgain == 'y':
caveNumber = chooseCave()
print('Do you want to play again? (yes or no)')
playAgain = input()
So i've followed along with this and now I want to add more to this game by adding more options for the player, like more caves for example.
How would I be able to do this?
If you could show me the code to answer my question or show me a good tutorial that would be most helpful.
Thanks in advance!