Richmond,

you compute too much in between!! In principle you have/need two commands

= one sets the angle of your widget,

= one moves the widget a given length in the given direction

(the length is the radius of a circle around current location).

I tried to write this as follows close to your style

(for the card's script, at about 20 lines for the two commands).

Code: Select all

```
-- AA is the FROM-angle (optional)
-- K is the CHANGE (pos=rightTurn or neg=leftTurn) to that angle
on turnBY K, AA
if AA is empty then put the angle of widget "TURTLE" into AA
add K to AA; put AA mod 360 into AA; if AA < 0 then add 360 to AA
set the angle of widget "TURTLE" to AA
end turnBY
-- x0 and y0 are the start points (optional)
-- R is the length to go forward in the turtle's path
on forwardzBy R,x0,y0
if x0 is empty then put item 1 of the loc of widget "TURTLE" into x0
if y0 is empty then put item 2 of the loc of widget "TURTLE" into y0
if there is no grc "TurtleCurve" then createTurtlePath "TurtleCurve"
put the angle of widget "TURTLE" into AA
add 90 to AA --> so that the angle zero is at high noon
put round(x0 - R*cos(AA*pi/180)) into newX
put round(y0 - R*sin(AA*pi/180)) into newY
put the points of grc "TurtleCurve" into PTS
put cr & (newX,newY) after PTS
put PTS into fld "LYNES" --> in case you wish to edit points
set points of grc "TurtleCurve" to PTS
set hilite of widget "TURTLE" to true -- just for fun
move widget "TURTLE" to line -1 of PTS in 1 second
set hilite of widget "TURTLE" to false
end forwardzBy
on createTurtlePath gg
create grc gg; set style of grc gg to "polygon"
set layer of widget "TURTLE" to "top"
put the width of widget "TURTLE" into twd
set foreColor of grc gg to "yellow" --> adjust here
set lineSize of grc gg to twd --> adjust here
set blendLevel of grc gg to 62 --> adjust here
end createTurtlePath
```

Hope this is the easy way you try to build upon.

Using this for example a regular Pentagon is drawn as follows.

Code: Select all

```
-- PENTAGON: Has 5 turns of 360/5 = 72 degrees and
-- 5 sides of equal length, say L = 200
on mouseUp
if there is no grc "TurtleCurve" then createTurtlePath "TurtleCurve"
set loc of widget "TURTLE" to the loc of this card
set the angle of widget "TURTLE" to 0
set points of grc "TurtleCurve" to the loc of this card -- start point
turnBy 54 -- startangle, half the vertices angle
repeat 5
turnBy 72; forwardzBy 200
end repeat
turnBy -54 -- back to angle zero
end mouseUp
```