BJC Snap! Cheat Sheet, Section Robot
I decided to make this block in Snap! here.
BJC Snap! Cheat Sheet, Section Robot
I decided to make this block in Snap! here.
That's cool -- it'll work for a robot on a grid, where you're only trying to move one square. (Although the grid is likely to be stamped on the pentrails rather than being other sprites.) In general, though, it runs the risk of jumping over another sprite.
Yes, if you go forward a lot, like 40x40 pixel sprites checking >80 pixels.
Why not use
warp { repeat (times) move (1) steps if <touching [sprite v]> then set [touched? v] to <<true (:: #</a>ffffff) :: #</a>00ff00> :: operators> } :: grey
to fix that?
[scratchblocks]can move in direction (90 v) distance (12.5) :: sensing boolean[/scratchblocks] 12.5.
tells the distance to the nearest costume pixels ahead, in sprite direction, in one go.
How about
warp { repeat (times) move (1) steps if <touching [sprite v]> then set [touched? v] to <<true (:: #</a>ffffff) :: #</a>00ff00> :: operators> } :: grey
[scratchblocks]
warp {
repeat (times)
move (1) steps
if <touching [sprite v]> then
set [touched? v] to <<true (:: #</a>ffffff) :: #</a>00ff00> :: operators>
} :: grey
[/scratchblocks]
(Why is the %bool
input type so hard to make with scratchblocks?)
<<true (:: #</a>dcdcdc) :: #</a>00ff00> :: operators>
[scratchblocks]<<true (:: #</a>dcdcdc) :: #</a>00ff00> :: operators>[/scratchblocks]
My version.
Here's the real thing:
Do you not see that the circle is white, not gray?
It actually is a light gray, specifically 0xdcdcdc.
fixed.
It still looks a little bit darker in the scratchblocks.
It looks white to me, even if the RGB is 0XDCDCDC.
It's off-white.
Even [scratchblocks]:: #cccccc reporter[/scratchblocks]
[scratchblocks]:: #</a>cccccc reporter[/scratchblocks]
looks white to me
How colors look (a subject about which I know far too much, although still not enough) depends a lot on the background. Take this Exploratorium exhibit:
The effect is clearer in person than in a photo, but this looks like a uniform light gray with a rope hanging in front of it, until you move the rope:
Now the two colors are very clearly different.
If the dot in the Boolean input block were against a white background instead of a green one, the difference would be more obvious.
( :: #</a>dcdcdc) :: #</a>ffffff boolean
[scratchblocks] ( :: #</a>dcdcdc) :: #</a>ffffff boolean[/scratchblocks]
You're right.
TOUCHING takes a list as input? Who knew!
You should also save and restore the pen state, and do a PEN UP before the loop.