Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name="blank"
- import os
- #Set up all the processes and functions etc.
- #----------------------------------------------------------------
- def initLocations():
- locName = ["The Town","The Blacksmith Hut","The Pub","The Street","The Library"]
- locDesc = ["A Small Town","A Small Hut","A nice pub","An ancient paved street","Filled with brilliant books"]
- return locName, locDesc
- def initVariables():
- global health
- health=10
- global currentLoc
- currentLoc=0
- return currentLoc, health
- def gameInit():
- initVariables()
- initLocations()
- def mainProcess(command):
- if command=="help":
- displayMessage("help")
- pass
- if command=="play":
- gameInit()
- pass
- if command=="move":
- displayMessage("move")
- pass
- def displayMessage(call):
- os.system("cls")
- if call=="help":
- print("**HELP**")
- print("")
- print("The Adventure Game uses a system of commands")
- print("Here is a list of currently known commands:")
- print("")
- print("- MOVE - Allows the player to move left or right")
- print("")
- input("Press any key to return....")
- pass
- if call=="move":
- print("Move where?")
- print("")
- if currentLoc==0:
- print("Left: You cannot move left.")
- print("Right: " + locName[currentLoc+1])
- elif currentLoc>1:
- print("Left: " + locName[currentLoc-1])
- print("Right: " + locName[currentLoc+1])
- print("")
- print("Move left or right? Enter your choice.")
- direction = input("?: ")
- if direction=="left":
- print("Moved left.")
- if currentLoc>1:
- currentLoc = currentLoc-1
- pass
- elif direction=="right":
- currentLoc = currentLoc+1
- pass
- pass
- input("Press any key to return....")
- os.system("cls")
- #----------------------------------------------------------------
- #Main Game
- print("Adventure Game")
- print("")
- print("Please enter your name: ")
- name = input("?: ")
- while name=="":
- os.system("cls")
- print("* - Make sure you enter a name.")
- print("")
- print("Please enter your name: ")
- name = input("?: ")
- pass
- print("Hello, " + name + "!")
- print("")
- global currentLoc
- currentLoc, health = initVariables()
- gameInit()
- locName, locDesc = initLocations()
- #Let's say the final location is 20.
- while currentLoc<20:
- print(currentLoc)
- #Locations
- print(locName[currentLoc])
- print(locDesc[currentLoc])
- print("Type 'Help' for advice on what to do next.")
- passedCommand = input("?: ")
- mainProcess(passedCommand)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement