Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/TurtleArt
diff options
context:
space:
mode:
Diffstat (limited to 'TurtleArt')
-rw-r--r--TurtleArt/tabasics.py29
-rw-r--r--TurtleArt/taconstants.py3
-rw-r--r--TurtleArt/taturtle.py24
3 files changed, 20 insertions, 36 deletions
diff --git a/TurtleArt/tabasics.py b/TurtleArt/tabasics.py
index 4254967..a7dbd5b 100644
--- a/TurtleArt/tabasics.py
+++ b/TurtleArt/tabasics.py
@@ -276,21 +276,6 @@ towards the top of the screen.)'))
call_afterwards=lambda value: self.after_set(
'heading', value)))
- palette.add_block('setxyz',
- style='basic-style-3arg',
- # TRANS: xyz are coordinates in a 3-dimensional space
- label=[_('set xyz') + '\n\n',
- _('x'), _('y'), _('z')],
- prim_name='setxyz',
- default=[0, 0, 0],
- help_string=_('sets the xyz-coordinates of the \
-turtle'))
- self.tw.lc.def_prim(
- 'setxyz', 3,
- Primitive(Turtle.set_xyz,
- arg_descs=[ArgSlot(TYPE_NUMBER), ArgSlot(TYPE_NUMBER),
- ArgSlot(TYPE_NUMBER)]))
-
palette.add_block('xcor',
style='box-style',
label=_('xcor'),
@@ -321,20 +306,6 @@ the turtle (can be used in place of a number block)'),
ConstantArg(Primitive(
self.tw.get_coord_scale))]))
- palette.add_block('zcor',
- style='box-style',
- label=_('zcor'),
- help_string=_('holds current z-coordinate value of \
-the turtle (can be used in place of a number block)'),
- value_block=True,
- prim_name='zcor')
- self.tw.lc.def_prim(
- 'zcor', 0,
- Primitive(Primitive.divide, return_type=TYPE_FLOAT,
- arg_descs=[ConstantArg(Primitive(Turtle.get_z)),
- ConstantArg(Primitive(
- self.tw.get_coord_scale))]))
-
palette.add_block('heading',
style='box-style',
label=_('heading'),
diff --git a/TurtleArt/taconstants.py b/TurtleArt/taconstants.py
index 0a3cc23..87616d6 100644
--- a/TurtleArt/taconstants.py
+++ b/TurtleArt/taconstants.py
@@ -273,7 +273,8 @@ CONSTANTS = {'leftpos': None, 'toppos': None, 'rightpos': None,
# Blocks that are expandable
EXPANDABLE_STYLE = ['boolean-style', 'compare-porch-style', 'compare-style',
'number-style-porch', 'number-style', 'basic-style-2arg',
- 'number-style-block', 'box-style-media']
+ 'number-style-block', 'box-style-media',
+ 'basic-style-3arg']
# These are defined in add_block based on block style
EXPANDABLE_FLOW = []
diff --git a/TurtleArt/taturtle.py b/TurtleArt/taturtle.py
index 08a896e..ccdd60b 100644
--- a/TurtleArt/taturtle.py
+++ b/TurtleArt/taturtle.py
@@ -141,8 +141,10 @@ class Turtles:
self._active_turtle.set_gray(100)
if self.turtle_window.coord_scale == 1:
self._active_turtle.set_pen_size(5)
+ self._active_turtle.set_z_scale = 100.
else:
self._active_turtle.set_pen_size(1)
+ self._active_turtle.set_z_scale = 20.
self._active_turtle.reset_shapes()
self._active_turtle.set_heading(0.0)
self._active_turtle.set_pen_state(False)
@@ -230,6 +232,7 @@ class Turtle:
self._x = 0.0
self._y = 0.0
self._z = 0.0
+ self._z_scale = 100.
self._heading = 0.0
self._half_width = 0
self._half_height = 0
@@ -355,6 +358,9 @@ class Turtle:
self._custom_shapes = False
self._calculate_sizes()
+ def set_z_scale(self, scale):
+ self._z_scale = scale
+
def set_heading(self, heading, share=True):
''' Set the turtle heading (one shape per 360/SHAPES degrees) '''
self._heading = heading
@@ -565,8 +571,8 @@ class Turtle:
old = self.get_xy()
if self._z > 0.0:
- old[0] = old[0] * ((self._z / 100.) + 1)
- old[1] = old[1] * ((self._z / 100.) + 1)
+ old[0] = old[0] * ((self._z / self._z_scale) + 1)
+ old[1] = old[1] * ((self._z / self._z_scale) + 1)
xcor = old[0] + scaled_distance * sin(self._heading * DEGTOR)
ycor = old[1] + scaled_distance * cos(self._heading * DEGTOR)
@@ -587,8 +593,8 @@ class Turtle:
self.set_xy(x, y, share, pendown)
def set_z(self, z, share=True, pendown=True):
- xcor = self._x * ((self._z / 100.) + 1)
- ycor = self._y * ((self._z / 100.) + 1)
+ xcor = self._x * ((self._z / self._z_scale) + 1)
+ ycor = self._y * ((self._z / self._z_scale) + 1)
self._z = z
self.set_xy(xcor, ycor, share, pendown)
@@ -602,8 +608,8 @@ class Turtle:
ycor = y * self._turtles.turtle_window.coord_scale
if not dragging and self._z > 0.0:
- xcor /= ((self._z / 100.) + 1)
- ycor /= ((self._z / 100.) + 1)
+ xcor /= ((self._z / self._z_scale) + 1)
+ ycor /= ((self._z / self._z_scale) + 1)
self._draw_line(old, (xcor, ycor), pendown)
self.move_turtle((xcor, ycor))
@@ -637,6 +643,9 @@ class Turtle:
r = -r
a = -a
pos = self.get_xy()
+ if self._z > 0.0:
+ pos[0] = pos[0] * ((self._z / self._z_scale) + 1)
+ pos[1] = pos[1] * ((self._z / self._z_scale) + 1)
cx = pos[0] + r * cos(self._heading * DEGTOR)
cy = pos[1] - r * sin(self._heading * DEGTOR)
if self._pen_state:
@@ -661,6 +670,9 @@ class Turtle:
r = -r
a = -a
pos = self.get_xy()
+ if self._z > 0.0:
+ pos[0] = pos[0] * ((self._z / self._z_scale) + 1)
+ pos[1] = pos[1] * ((self._z / self._z_scale) + 1)
cx = pos[0] - r * cos(self._heading * DEGTOR)
cy = pos[1] + r * sin(self._heading * DEGTOR)
if self._pen_state: