0% found this document useful (0 votes)
5 views6 pages

Grad. Project T

Uploaded by

yomnaashraf245
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Grad. Project T

Uploaded by

yomnaashraf245
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 6

# Defigning the main game as a function

def play_game ():


import random
enemies = ["zombies","mummies","wendigos","vampiers"]
monster = random.choice(enemies)
# Importing the time module
import time
# Asigning the variable a restart value of 0
your_score = 0
# Defigning a function to print and pause two seconds
def print_pause (text):
print(text)
time.sleep(2)
# Defigning a funtion to add one to the total score
def add_one(your_score):
your_score += 1
print("(score +1)")
return your_score
# Defigning a funtion to subtrsct one to the total score
def sub_one(your_score):
your_score -= 1
print("(score -1)")
return your_score
# Defigning a function to replay after wining or not
def alive ():
print("you have survived")
print("GAME FINISHED")
print ("your score now is :",your_score )
againorexit = input("do you want to play again? (y/n)")
while againorexit not in ["y","n"]:
againorexit = input("Invalid choice. Please choose y or n: ")
if againorexit == "y":
play_game()
elif againorexit == "n":
print("EXIT")
# Defigning a function to replay after losing or not
def dead():
print("you are dead \nGAME OVER")
print("your score now is :", your_score)
againorexit = input("do you want to play again? (y/n)")
while againorexit not in ["y", "n"]:
againorexit = input("Invalid choice. Please choose y or n: ")
if againorexit == "y":
play_game()
elif againorexit == "n":
print("EXIT")
# To make the player enter their name in the name variable
name = input("Enter your name:")
print( name + ",")
time.sleep(1)
# Describing the starting nature of the game
print_pause("you wake up to find yourself in a dark hospital room")
print_pause("you have been in a coma for 3 years")
print_pause("the room around you is weirdly messy for a hopital room ")
print_pause("almost as if someone had a fight hear")
print_pause("you try to get up but you feel pain in the back of your head you
touch it you find blood")
print_pause("you manage to get up headed to open the door to seek help, but
there is something blocking it ")
print_pause("so you have two options :")
print_pause("enter 1 to force open the door")
print_pause("enter 2 to call for help")
# Making the player choose their first choice
choice = input("Please choose 1 or 2: ")
while choice not in ["1", "2"]:
choice = input("Invalid choice. Please choose 1 or 2: ")
if choice == "1":
# Describing the scene after the first choice
print_pause("You try to force open the door but find out it was a hospital
bed blocking the door.")
print_pause("you look up to see its a nurse at the end of the corridor
'nurse! i need help i think i'm bleeding'")
print_pause("she keeps walking up to you ,staring at you 'ummm, are you
okay? you look a little pale' you tell her and all of a sudden she starts running
towards you ")
print_pause("growling like some kind of animal she is attacking you trying
to bite you , you try to get her off you but already lost alot of strength")
print("she bit you ,she is a",end=" ")
print(monster)
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print("Your score is now:", your_score)
time.sleep(2)
print_pause(", you pushed her away from you and started to run to:")
print_pause("enter 1 to run to the room")
print_pause("enter 2 to run to the opposite side of the corridor")
# Making the player choose their second choice
choice2 = input("what would you choose?")
while choice2 not in ["1", "2"]:
choice2 = input("Invalid choice. Please choose 1 or 2: ")
if choice2 == "1":
# Describing the scene after the second choice
print_pause("you run back to the room and lock yourself in , you try to
find a weapon to defend yourself")
# Calling the adding one function and showing the end value
your_score = add_one(your_score)
print("your score now is :",your_score )
print_pause("you search around for supplies you found:")
print_pause("1.the bed table as a sheild \n2.a broken chaire leg as a
weapon")
print_pause("3.in your closet you found a backpack with some clothes
you put them on and fill the backpack with what you could find")
print_pause("you notice the window ,you check to see and it looks like
you can survive the fall:")
print_pause("enter 1 to jump out the window")
print("enter 2 to attack the",end=" ")
print(monster,end="")
print("nurse outside and get out the main exit")
# Making the player choose their third choice
choice3 = input("what would you choose?")
while choice3 not in ["1", "2"]:
choice3 = input("Invalid choice. Please choose 1 or 2: ")
if choice3 == "1":
# Describing the scene after the third choice
print_pause("you grabed your stuff and started climbing out the
window ")
print_pause("turns out you can't really survive the fall so you
decide to climb down instead")
print_pause("you were sucessful until a group of those creapy
people gathered down trying to attack you")
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print("your score now is :",your_score )
print_pause("you ran with the little speed you have left into :")
print_pause("enter 1 into the forest")
print_pause("enter 2 into a car")
# Making the player choose their fourth choice
choice4 = input("what would you choose?")
while choice4 not in ["1", "2"]:
choice4 = input("Invalid choice. Please choose 1 or 2: ")
if choice4 == "1":
# Describing the scene after the fourth choice
print_pause("you started runing into the forest")
# Calling the subtracting one function and showing the end
value
your_score = sub_one(your_score)
print("your score now is :",your_score )
time.sleep(2)
print_pause("you kept on runing to find shelter you couln't
find any so you will spend the night in the forest")
print_pause("you wake up with unbelievable pain where the bite
is , it's infected and the bleeding wouln't stop")
# Calling the dead function
dead()
elif choice4 == "2":
# Describing the scene after the fourth choice
print_pause("you run to the nearest open car")
# Calling the adding one function and showing the end value
your_score = add_one(your_score)
print ("your score now is :",your_score )
print_pause("lucky for you ,you found the keys in the pockets
of the dead body next to you and you start driving away from the hospital")
# Calling the alive function
alive()
elif choice3 == "2":
# Describing the scene after the third choice
print_pause("you open the door as hard as you can to push miss
biter as far away from the door as posible")
print_pause("you hold the chaire leg and push it with all the power
you have into her head")
print_pause(" you someone behind you, you turn around to meet a
'hi' \n'umm hello ,' \nshe is a human about 11 years old\n'you're a human omg come
on let me introduce you to our group'")
# Calling the alive function
alive()
elif choice2 == "2":
# Describing the scene after the second choice
print_pause("you turn back and run in the corridor you kept on runing
and stumbling upon dead bodies until you found a turn to the exit stairs ")
print_pause("you run down those stairs and the sun flashes into your
face making you even more dizzy")
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print("Your score is now:", your_score)
time.sleep(2)
print_pause("but you manage to get out of the hospital, you look around
there is like a thousands of those biters")
print_pause("you look up front to find a car, you can't really see but
there is a human in it, an alive one so you :")
print_pause("enter 1 to shout for help")
print_pause("enter 2 to just run there quietly")
# Making the player choose their fifth choice
choice5 = input("what would you choose?")
while choice5 not in ["1", "2"]:
choice5 = input("Invalid choice. Please choose 1 or 2: ")
if choice5 == "1":
# Describing the scene after the second choice
print_pause("'HHEYY!!, YOU IN THE CAR I NEED HELPPP' waving your
hands trying to get his attention")
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print("Your score is now:", your_score)
print_pause("you got the attention of all the surrounding
monsters , they are rushing at you and you couldn't escape")
# Calling the dead function
dead()
elif choice5 == "2":
# Describing the scene after the second choice
print_pause("you run quetly till you reach the car the person
notices you and tells you to come in")
print_pause("you get in the car the person notices your neck'is
that a bite' he asks, you nod 'i'm also bleeding i need help'")
print_pause("'i know someone who can help let's get you out of
here'he says you show graditude and you both start your journey to meet a doctor")
# Calling the adding one function and showing the end value
your_score = add_one(your_score)
print("Your score is now:", your_score)
# Calling the alive function
alive()
elif choice == "2":
# Describing the scene after the first choice
print_pause("You call for help: 'HELP!! Is anyone here?'")
# Calling the adding one function and showing the end value
your_score = add_one(your_score)
print("Your score is now:", your_score)
time.sleep(2)
print_pause("You wait for a response but there is none, until you see
shadows of some people from the crack.")
print_pause("but they are grumping and bumping on the door 'Hey!,the door
is blocked right, please help me i'm injured'")
print_pause("you keep waiting for any response there is nothing but weird
noises 'HELLO, what are you doing?'")
print_pause("you give up contacting them , but you found your phone it's on
low charge but you decide to slide it under the door frame and capture a vedio")
print("when you are finished you take the phone back to find three grumpy
looking humans, their skin is as pale as a ghost ,\ntheir clothes are torn and full
of rotting blood, and they can't comunicate\nthey have to be a",end=" ")
print(monster,"!!!")
print_pause("enter 1 to stay silent and do nothing")
print_pause("enter 2 to find a way to survive")
# Making the player choose their sixth choice
choice6 = input("what would you choose?")
while choice6 not in ["1", "2"]:
choice6 = input("Invalid choice. Please choose 1 or 2: ")
if choice6 == "1":
# Describing the scene after the sixth choice
print_pause("you stayed back horified , until they managed to break
through the door")
dead()
elif choice6 == "2":
# Describing the scene after the sixth choice
print_pause("you look around for supplies , you found :")
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print ("your score now is :",your_score )
print_pause("1.the bed table as a sheild \n2.a broken chaire leg as a
weapon \n3.in your closet you found a backpack with some clothes you put them on
and fill the backpack with anything you could find")
print_pause("you opened some music on your phone and put it in the
bathroom as a trap")
print_pause("you put the hospital bed next to the door and opened it
and you hid behind the bed")
print_pause("the music distracted the zombies enough for yo to run out
the bedroom")
print_pause("you run until you find a group of zombies blocking the
exit you look around the only choise is to jump through the glass window")
print_pause("you break the window and run blindly to the nearest house
you managed to find a phone and decided to call :")
print_pause("enter 1 to call the police")
print_pause("enter 2 to call your family")
# Making the player choose their seventh choice
choice7 = input("what would you choose?")
while choice7 not in ["1", "2"]:
choice7 = input("Invalid choice. Please choose 1 or 2: ")
if choice7 == "1":
# Describing the scene after the seventh choice
print_pause(" you called the police they told you the millitary is
on their way to you")
# Calling the alive function
alive()
elif choice7 == "2":
# Describing the scene after the seventh choice
print_pause("you called all the numbers you can remeber there is no
answer")
# Calling the subtracting one function and showing the end value
your_score = sub_one(your_score)
print ("your score now is :",your_score )
print_pause("you look around for some bandages or something to help
with bleeding , you tried to open a drawer it fell making a lot of noise")
print("you decide to run upstaires for protection meeting a
small",end=" ")
print(monster)
print_pause("enter1 to grab anything and bang it on the kids head")
print_pause("enter2 to try and escspe without violence")
# Making the player choose their eighth choice
choice8 = input("what would you choose?")
while choice8 not in ["1", "2"]:
choice8 = input("Invalid choice. Please choose 1 or 2: ")
if choice8 == "1":
# Describing the scene after the eighth choice
print_pause("you grab a vase and smash it on it's head doing
absloutly nothing you grab another one and another , there is none left and the kid
is still alive")
# Calling the subtracting one function and showing the end
value
your_score = sub_one(your_score)
print ("your score now is :",your_score )
print_pause("the shatering noise gathered all the surounding
monsters , crashing into the house distroying the windows")
# Calling the dead function
dead()
elif choice8 == "2":
print_pause("you try to run out of the house")
# Calling the adding one function and showing the end value
your_score = add_one(your_score)
print ("your score now is :",your_score )
print_pause("searching for shelter for the night stumbling upon
a car with keys you decide to get in it and drive to find anything that could help
you")
# Calling the alive function
alive()
# Calling the main function to start the game
play_game()

You might also like