Hi everyone, recentley new to programming and the language python.
So ive learned an amount of python, i decided to start a projct.
My project is to make a game, which the user plays using only commands, like walk foward, open the door etc, you are in the bedroom... whatever.
Ive started programming some of it but wondering how to link back to a previous line and start from there again, and also once a command has been said it can then progress onto the next stage, for example the user is sat on the bed, but stands up from the users input command, then the next stage of commands that would be available should be loaded and then continue depending on the users input.
Heres what ive got so far
import sys, os
print ("You wake up and you do not remember anything...")
raw_input("Press Enter to continue..")
os.system('cls')
print ("You sit up and find yourself in a bedroom")
raw_input("Press Enter to continue..")
os.system('cls')
#print ("You try to stand up but you are hand cuffed to the bed, what do you do?")
#look around, to the left is..., infront of you is..., to the right of you is, above you is..., behind you is..., below you is...
command = raw_input("What do you do?: ")
while 1:
if command == "look up":
print "You look up to the ceiling but nothing of any use is up there."
break
elif command == "look down":
while 1:
print "You look down you are sat on a bed."
break
elif command == "look to the left":
while 1:
print "You look to the left and see a cabinet."
break
elif command == "look to the right":
while 1:
print ("You look to the right and see set of drawers.")
break
elif command == "look behind yourself":
while 1:
print ("You look behind yourself and they is a wall.")
break
elif command == "look ahead":
while 1:
print ("You look ahead and see a door")
break
else:
print "Invalid action"
command = raw_input("Try doing something else: ")
so say the user looks up, the command then says what is above the user, then id like it to return back to the choices available as the user hasnt moved, and then making the user move and progress to the next available moves. It sounds a bit complicated to explain but i think someone will understand me.
Cheers
roshurwill