I would really like a block that is "repeat until I receive ___" or "wait until I receive ___",
then instead millions of "When I receive" block, you could have it all in one script
Also, a "When [a variable] changes" would be great, then instead of "Forever>if [a variable] = 1 > switch to costume 1" and do on, you could have a " When [a variable] changes > next costume"
Offline
Vis that last point - as long as your costumes are arranged in the right order, you can use the number of the costume (inserted as a variable) instead of its name.
So you don't need
If (VARIABLE = 1)
- SWITCH TO [Costume 1]
You can just have
SWITCH TO (VARIABLE]
Offline
But it's for other things as well, such as (for example) "When [a variable] changes > say "A variable has changed""
Offline
I would also like a Sensing block: <[sprite] clicked>, so you can make something like "repeat until <[sprite] clicked>", then do ------". And a sound block: "stop sound [sound]", so you can stop one particular sound, not all. And maybe a Pen block: "set pen to eraser/pen" or something like that, so you can erase parts of what you've drawn, not clear all together. Of course, you can "erase" the drawing by setting the color of the pen to the color of the background, but what if the background is a picture?
Last edited by MyRedNeptune (2007-08-18 04:29:09)
Offline
MyRedNeptune, all you have to do for the repeat until sprite clicked is this; [blocks]
<when green flag clicked>
<repeat until><< <mouse down?> <and> <touching[ mousepointer >>
[/blocks] do whatever you want it to do before
whatever you want it to do after
Last edited by Llamalover (2007-08-18 10:44:36)
Offline
Actually, llamalover, I think that "sprite clicked" is not quite equivalent to mouse-down and touching.
Try playing a sound from the "when sprite clicked". If you put the mouse over the sprite and hold the mouse button down, the sound does not play until you RELEASE the button.
(This only works in presentation mode or the java interpreter, since the programming mode switches to moving the sprite if you hold the mouse down over it.)
So repeat until sprite clicked requires detecting a transition from mouse down to mouse up while over the sprite. The initial press does not have to be on the sprite, only the release does. Emulating this behavior in scratch precisely *can* be done, but the programming is trickier. I'm not sure what the easiest way to do it would be---perhaps having a variable for each <sprite clicked> instance:
[blocks]
<when green flag clicked>
<forever if> <mouse down?>
<set{ test }to( 0
<wait until> << <not> <mouse down?> >>
<if> <touching[ mouse
<set{ test }to( 1
<end>
<end>
The repeat until sprite clicked becomes
<repeat until> test <>> 0
<set{ test }to( 0
....
<end>
You need a separate variable for each test, unless you want only one script to see the click (and that isn't guaranteed, since the test and the reset are not simultaneous).
Last edited by kevin_karplus (2007-08-18 11:44:59)
Offline