import os
import random
print """\n\tZombies have invaded your friends home!!! \tYou have to find your way out, and escape the hordes that are \tcoming there is a map that can lead you out but be careful with the zombies!!!"""
zom = {1:"MAIN ROOM",2:"DINING ROOM", 3:"LIVING ROOM", 4:"PATIO", 5:"KITCHEN", 6:"BACKYARD", 7:"HOLE", 8:"WELL", 9:"TREEHOUSE", 10:"PANTRY", 11:"UPSTAIRS", 12:"ROOM1", 13:"ROOM2", 14:"ATTIC", 15:"RESTROOM", 16:"FRONT YARD", 17:"FRONT PORCH"}
word = random.choice(zom)
print word #im trying to check the room the zombie is in
def startgame(): while True: print "\nYou are in the Main Room" zombi()#zombie function game over room = raw_input("\nCHOOSE\n1.Patio\n2.Living Room\n3.Dining Room\n4.Kitchen\n") if room == "1":#How do i get room to be equal to word zom[0] patio() elif room == "2": zom[2] lr() elif room == "1": zom[1] dr() elif room == "4": zom[4] kitchen() else: print "Not possible" exit(0)
def zombi(): if word == room: print "GAME OVER" exit(0)
My end function, will end the game if user inputs same room as the random zombie
I'm using Python 2.7.1, I can't find a solution, sorry I'm still learning so I've been searching around but haven't found anything i had a list now i switched to a dictionary **It's a text input game where you navigate through the rooms avoiding random zombies, until you make your way out.. included is a map of the house you're stuck in..Everything works except the game over func.. I have to finish the rooms but I'm just trying to see if my game over function works.. I'm using python 2.7.10 and atom and running my game through windows powershell Many thanks. **
Aucun commentaire:
Enregistrer un commentaire