I am very new to Python. running on windows while I wait for some stuff for my Pi. I am writing a game where the user travels through a tower via text inputs.
the user can use "a" "d" "w" to look around a room to collect sutff. but if the user has already looked in "a" (which is "look left") i need to let them know they have already been there. this is my code but it has an obvious flaw.
#if user hits 'a' they look left
def roomOneLeft():
print '-- You search some loose rubble and find some cloth'
return roomOneMoves()
#where the user selects a movement
def roomOneMoves():
left = 0
move = raw_input("")
if left == 1:
print 'you have already looked here'
return roomOneMoves()
if move == "a":
left = left + 1
roomOneLeft()
can i set "left" to static? and ant work out how to set it as global variable like java. this obviously doesn't work because when it returns, it sets itself back to 0. any help would be greatly appreciated!