Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/taturtle.py
diff options
context:
space:
mode:
Diffstat (limited to 'taturtle.py')
-rw-r--r--taturtle.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/taturtle.py b/taturtle.py
index 42a54c9..acf051e 100644
--- a/taturtle.py
+++ b/taturtle.py
@@ -80,6 +80,7 @@ class Turtle:
scale=1.0):
self.x = 0
self.y = 0
+ self.hidden = False
self.shapes = []
self.type = 'turtle'
self.heading = 0
@@ -110,9 +111,11 @@ class Turtle:
self.heading = heading
i = (int(self.heading+5)%360)/10
try:
- self.spr.set_shape(self.shapes[i])
+ if self.hidden is False:
+ self.spr.set_shape(self.shapes[i])
except IndexError:
- self.spr.set_shape(self.shapes[0])
+ if self.hidden is False:
+ self.spr.set_shape(self.shapes[0])
print "Turtle shape IndexError %f -> %d" % (heading, i)
def set_color(self, color):
@@ -129,13 +132,18 @@ class Turtle:
def hide(self):
self.spr.set_layer(HIDE_LAYER)
+ self.hidden = True
def show(self):
self.spr.set_layer(TURTLE_LAYER)
+ self.hidden = False
+ self.move((self.x, self.y))
+ self.set_heading(self.heading)
def move(self, pos):
self.x, self.y = pos[0], pos[1]
- self.spr.move(pos)
+ if self.hidden is False:
+ self.spr.move(pos)
def get_xy(self):
return(self.x, self.y)