Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarion <marion.zepf@gmail.com>2013-09-13 21:43:53 (GMT)
committer Marion <marion.zepf@gmail.com>2013-09-13 21:43:53 (GMT)
commitb6ba9c8cc0b56b9c154e2837abfeda75fd7db3da (patch)
tree503ab3ee2879d5c6aa5560520d1cb2d752ed5745
parent89c3fc127cadc61da556165020f7cd82649cf7fd (diff)
update the heading of the turtle sprite after the 'left' or 'right' block
-rw-r--r--TurtleArt/taturtle.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py
index 8d2afea..e958f94 100644
--- a/TurtleArt/taturtle.py
+++ b/TurtleArt/taturtle.py
@@ -333,6 +333,15 @@ class Turtle:
return
self._heading %= 360
+ self._update_sprite_heading()
+
+ if self._turtles.turtle_window.sharing() and share:
+ event = 'r|%s' % (data_to_string([self._turtles.turtle_window.nick,
+ round_int(self._heading)]))
+ self._turtles.turtle_window.send_event(event)
+
+ def _update_sprite_heading(self):
+ ''' Update the sprite to reflect the current heading '''
i = (int(self._heading + 5) % 360) / (360 / SHAPES)
if not self._hidden and self.spr is not None:
try:
@@ -340,11 +349,6 @@ class Turtle:
except IndexError:
self.spr.set_shape(self._shapes[0])
- if self._turtles.turtle_window.sharing() and share:
- event = 'r|%s' % (data_to_string([self._turtles.turtle_window.nick,
- round_int(self._heading)]))
- self._turtles.turtle_window.send_event(event)
-
def set_color(self, color=None, share=True):
''' Set the pen color for this turtle. '''
# Special case for color blocks
@@ -525,6 +529,8 @@ class Turtle:
return
self._heading %= 360
+ self._update_sprite_heading()
+
if self._turtles.turtle_window.sharing() and share:
event = 'r|%s' % (data_to_string([self._turtles.turtle_window.nick,
round_int(self._heading)]))