posted on May, 16 2013 @ 10:53 PM
reply to post by locololo
The problem is with namespaces. location is defined within the namespace of the function, but you set it as if you want to set the location variable
you defined at the beginning.
The right solution - have you ever made a class? It would look like this:
class MyGame:
def __init__(self):
self.location = (1,1) #start location
def move_player(self, direction):
if direction == "up": self.location = (self.location[0], self.location[1]+1)
....
sorry, ATS edits out tabs.
edit on 16-5-2013 by tridentblue because: (no reason given)