mirror of
https://github.com/metafy-social/python-scripts.git
synced 2024-12-18 00:00:17 +00:00
refactored code and added instructions
This commit is contained in:
parent
03460ef601
commit
49809ca99d
|
@ -1,4 +1,18 @@
|
||||||
Text Based Adventure Game
|
Text Based Adventure Game
|
||||||
An emersive adventure game with a thrilling story and action
|
An emersive adventure game with a thrilling story and action.
|
||||||
|
|
||||||
Enjoy and have fun !!!
|
Enjoy and have fun !!!
|
||||||
|
|
||||||
|
|
||||||
|
Installation:
|
||||||
|
|
||||||
|
mathod 1 -
|
||||||
|
Download the file Text_Game.py which is inside text_game folder
|
||||||
|
Click on terminal and New terminal
|
||||||
|
Run game by clicking run button
|
||||||
|
|
||||||
|
method 2 -
|
||||||
|
Download the file Text_Game.py which is inside text_game folder
|
||||||
|
Double Click on downloded file andit will run the game
|
||||||
|
|
||||||
|
All of the libraries used are pre installed with python so you dont need to manually install anything.
|
||||||
|
|
|
@ -3,11 +3,12 @@ import time
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
print('Hello you r in the future and r fighting a robot')
|
# story generated
|
||||||
|
print('Hello you are in the future and are fighting a robot')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('you dont know what to do, thats why im here')
|
print('you dont know what to do, thats why im here')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('I am a Simulated Artificial Machine but u can call me S.A.M.')
|
print('I am a Simulated Artificial Machine but you can call me S.A.M.')
|
||||||
smileyface()
|
smileyface()
|
||||||
|
|
||||||
def smileyface():
|
def smileyface():
|
||||||
|
@ -25,32 +26,39 @@ def smileyface():
|
||||||
print('|________________|')
|
print('|________________|')
|
||||||
|
|
||||||
|
|
||||||
|
# First obstacle
|
||||||
def level1():
|
def level1():
|
||||||
a = ''
|
question_one = ''
|
||||||
while a != 'run away' and a != 'shoot robot in head':
|
while question_one != 'run away' and question_one != 'shoot robot in head':
|
||||||
a = input('u can currently do two things which is either run away or shoot robot in head, what do u choose: ')
|
question_one = input('You can currently do two things which is either run away or shoot robot in head, what do you choose: ')
|
||||||
if a == 'run away':
|
|
||||||
|
#if chosen option and outcome of option
|
||||||
|
if question_one == 'run away':
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('Unfortunately you have now been hunted down by an army of robots and have been executed')
|
print('Unfortunately you have now been hunted down by an army of robots and have been executed')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('too bad')
|
print('too bad')
|
||||||
res = input('Do you wanna restart: ')
|
|
||||||
if res == 'yes':
|
|
||||||
|
# restart for when user fails
|
||||||
|
restart = input('Do you wanna restart: ')
|
||||||
|
if restart == 'yes':
|
||||||
start()
|
start()
|
||||||
level1()
|
level1()
|
||||||
path()
|
path()
|
||||||
again = choice()
|
again = choice()
|
||||||
wtf(again)
|
random_select(again)
|
||||||
else:
|
else:
|
||||||
print('bye')
|
print('bye')
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif a == 'shoot robot in head':
|
|
||||||
|
elif question_one == 'shoot robot in head':
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('Congratulations you shot the robot in the head and are not dead!!')
|
print('Congratulations you shot the robot in the head and are not dead!!')
|
||||||
|
|
||||||
|
|
||||||
def path():
|
def path():
|
||||||
|
# story generated
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('You are running away from the robots but...')
|
print('You are running away from the robots but...')
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
@ -63,18 +71,23 @@ def path():
|
||||||
print('choose wisely!!!!!!! ')
|
print('choose wisely!!!!!!! ')
|
||||||
print()
|
print()
|
||||||
|
|
||||||
|
# Second obstacle
|
||||||
def choice():
|
def choice():
|
||||||
d = ''
|
question_two = ''
|
||||||
while d != '1' and d != '2':
|
while question_two != '1' and question_two != '2':
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
d = input('So which one do you want to go on, path 1 or 2: ')
|
question_two = input('So which one do you want to go on, path 1 or 2: ')
|
||||||
return d
|
return question_two
|
||||||
|
|
||||||
def wtf(rightpath):
|
|
||||||
t = random.randint(1,2)
|
# random path chosen for user to be right or wrong
|
||||||
if rightpath == str(t):
|
def random_select(rightpath):
|
||||||
|
select = random.randint(1,2)
|
||||||
|
|
||||||
|
if rightpath == str(select):
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('good you went down the correct path and cheated death!!')
|
print('good you went down the correct path and cheated death!!')
|
||||||
|
|
||||||
else:
|
else:
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print('oh no you have been spotted by the robots!!!')
|
print('oh no you have been spotted by the robots!!!')
|
||||||
|
@ -82,13 +95,24 @@ def wtf(rightpath):
|
||||||
print('and you have been shot multiple time and are now dead.')
|
print('and you have been shot multiple time and are now dead.')
|
||||||
|
|
||||||
|
|
||||||
playAgain = "yes"
|
|
||||||
while playAgain == "yes" or playAgain == "y":
|
|
||||||
|
# option to play again at completion of game
|
||||||
|
play_again = "yes"
|
||||||
|
|
||||||
|
while play_again == "yes" or play_again == "y":
|
||||||
start()
|
start()
|
||||||
level1()
|
level1()
|
||||||
path()
|
path()
|
||||||
again = choice()
|
again = choice()
|
||||||
wtf(again)
|
random_select(again)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
playAgain = input("""Do you want to play again?
|
|
||||||
|
play_again = input("""Do you want to play again?
|
||||||
Type yes or y to play again and no or n if you want to stop: """)
|
Type yes or y to play again and no or n if you want to stop: """)
|
||||||
|
|
||||||
|
|
||||||
|
stop_game = "no"
|
||||||
|
while stop_game == "no" or stop_game == "n":
|
||||||
|
print('bye')
|
||||||
|
break
|
1
scripts/Text_Game/tempCodeRunnerFile.py
Normal file
1
scripts/Text_Game/tempCodeRunnerFile.py
Normal file
|
@ -0,0 +1 @@
|
||||||
|
break
|
Loading…
Reference in New Issue
Block a user