From 9daafd93a3b7f9ab23188855a1315aa418cd37e8 Mon Sep 17 00:00:00 2001 From: Tymewalk Date: Sun, 11 Sep 2016 13:36:51 -0500 Subject: [PATCH 1/3] Add prints For debugging --- slither/slither.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/slither/slither.py b/slither/slither.py index 302421b..9050427 100644 --- a/slither/slither.py +++ b/slither/slither.py @@ -108,7 +108,7 @@ def isFocused(): return bool(pygame.mouse.get_focused()) # Stage class -class Stage(): +class Stage(object): def __init__(self): self.snakey = pygame.image.load(os.path.join(os.path.dirname(__file__), "snakey.png")) self.costumes = collections.OrderedDict({"costume0" : self.snakey}) @@ -142,8 +142,11 @@ def costumeNumber(self): @costumeNumber.setter def costumeNumber(self, val): + print "Setting to %s" % (str(val)) val = val % len(self.costumes) + print "Evaluated to %s" % (str(val)) self.costumeName = list(self.costumes.keys())[val] + print "Evaluated to %s" % (self.costumeName) self.currentCostume = self.costumes[self.costumeName] self._costumeNumber = val @@ -173,6 +176,7 @@ def __init__(self): self.scale = 1 # How much to multiply it by in the scale self.zindex = 0 # How high up are we in the "z" axis? sprites.append(self) # Add this sprite to the global list of sprites + print "Sprite made" @property def zindex(self): From 2d5da3a0af9961cbc50caa1da7c3af1100c38777 Mon Sep 17 00:00:00 2001 From: Tymewalk Date: Sun, 11 Sep 2016 13:40:46 -0500 Subject: [PATCH 2/3] Remove prints --- slither/slither.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/slither/slither.py b/slither/slither.py index 9050427..78fb586 100644 --- a/slither/slither.py +++ b/slither/slither.py @@ -142,11 +142,8 @@ def costumeNumber(self): @costumeNumber.setter def costumeNumber(self, val): - print "Setting to %s" % (str(val)) val = val % len(self.costumes) - print "Evaluated to %s" % (str(val)) self.costumeName = list(self.costumes.keys())[val] - print "Evaluated to %s" % (self.costumeName) self.currentCostume = self.costumes[self.costumeName] self._costumeNumber = val @@ -176,7 +173,6 @@ def __init__(self): self.scale = 1 # How much to multiply it by in the scale self.zindex = 0 # How high up are we in the "z" axis? sprites.append(self) # Add this sprite to the global list of sprites - print "Sprite made" @property def zindex(self): From 0d915c55186bbf3e3544d367dfc4c47a69945f99 Mon Sep 17 00:00:00 2001 From: Tymewalk Date: Sun, 11 Sep 2016 13:42:38 -0500 Subject: [PATCH 3/3] Add underscores to variable names Still requires testing. --- slither/slither.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/slither/slither.py b/slither/slither.py index 78fb586..4f3fc56 100644 --- a/slither/slither.py +++ b/slither/slither.py @@ -112,8 +112,8 @@ class Stage(object): def __init__(self): self.snakey = pygame.image.load(os.path.join(os.path.dirname(__file__), "snakey.png")) self.costumes = collections.OrderedDict({"costume0" : self.snakey}) - self.costumeNumber = 0 - self.costumeName = "costume0" + self._costumeNumber = 0 + self._costumeName = "costume0" self.currentCostume = None self.bgColor = (255, 255, 255) @@ -122,7 +122,7 @@ def addCostume(self, costumePath, costumeName): '''Add a costume based on a given path and name.''' costume = pygame.image.load(os.path.join(scriptdir, costumePath)) self.costumes[costumeName] = costume - self.costumeName = costumeName # Switch to the new costume + self._costumeName = costumeName # Switch to the new costume def deleteCostumeByName(self, name): '''Delete a costume by name.''' @@ -143,7 +143,7 @@ def costumeNumber(self): @costumeNumber.setter def costumeNumber(self, val): val = val % len(self.costumes) - self.costumeName = list(self.costumes.keys())[val] + self._costumeName = list(self.costumes.keys())[val] self.currentCostume = self.costumes[self.costumeName] self._costumeNumber = val @@ -171,7 +171,7 @@ def __init__(self): self.direction = 0 # Direction is how much to change the direction, hence why it starts at 0 and not 90 self.show = True self.scale = 1 # How much to multiply it by in the scale - self.zindex = 0 # How high up are we in the "z" axis? + self._zindex = 0 # How high up are we in the "z" axis? sprites.append(self) # Add this sprite to the global list of sprites @property