@9214 A simple "" made me crazy....
I have a bunch of dynamically created buttons
Their face/data content refer to dynamically created areas objects
foreach [tag name] buttons [
keep compose [
(to set-word! name) area 300x50 (copy "") wrap
]
]
The function executed when I hit one of the buttons pass the face/data, which is <areaname> ,and then I print <areaname>/text....
I always had the same printed result despite the button I hit....
Four hours to discover that tiny "" had to be changed to (copy "") !
Does anyone knows the Logo? You can play with it here.
I want to mimic Logo's functionality. What I need is to keep a) current pen position and b) rotation. shape
sub-dialect keeps pen position but it does not know about rotation. I have found out that I can rotate over some point (rotate <degree> <point>
). However I am rotating using values computed by me. Here is an example. I want to draw square.
The Logo code:
; just so we can start as Red's shape
right 90
forward 40
right 90
forward 40
right 90
forward 40
right 90
forward 40
and here is the Red's code:
view [base 300x300 red draw [
shape [ move 100x100 ]
shape [ 'line 40x0 ]
rotate 90 140x100
shape ['line 40x0]
rotate 90 180x100
shape ['line 40x0 ]
rotate 90 220x100
shape ['line 40x0 ]
]
]
Is there some function or word that keeps current pen position? I want to use it like rotate 90 _pen-position_
instead of hard-coded rotate 90 220x100
.
view [
style small: area 30x30
button button button return
button button button return
area below small small small
]
<center>
parameter ( (optional) center of rotation (pair!)) doesn't matter. We should calculate <center>
parameter other way.
draw
/shape
of the Logo's features (rotation/heading, loops, conditions, functions etc)?
Draw
is static while watching the turtle move and draw is a big part of that experience, which means your Logo drawing commands are really tied to a timer of some kind. What we could do, then, is set a canvas face for the turtle commands, and as you run them, the draw
block for that face would be updated, so the Logo part is in control there.
while
that checks a condition every time (before entering body
block) and you have if
that need to check it once. You need a block to run code multiple times so if
doesn't need it.