This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-14 14:22:38

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

I would really like...

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"


Be nice, I'm an old lady  wink

Offline

 

#2 2007-08-14 14:30:17

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: I would really like...

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]


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#3 2007-08-15 06:51:28

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: I would really like...

But it's for other things as well, such as (for example) "When [a variable] changes > say "A variable has changed""


Be nice, I'm an old lady  wink

Offline

 

#4 2007-08-15 17:53:13

relyt12101
Scratcher
Registered: 2007-05-19
Posts: 500+

Re: I would really like...

See here.


http://img392.imageshack.us/img392/2860/pspbanneregg089deiy0.png

Offline

 

#5 2007-08-15 18:44:05

AngelEyra
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: I would really like...

Also, see here

eyra


AngelEyra's . MyScratchR . Blog
Think with portals
Sorry, Companion Cube... I didn't mean to...

Offline

 

#6 2007-08-18 04:27:57

MyRedNeptune
Community Moderator
Registered: 2007-05-07
Posts: 1000+

Re: I would really like...

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)


http://i52.tinypic.com/5es7t0.png I know what you're thinking! "Neptune! Get rid of those filthy advertisements and give us back the Zarathustra siggy, you horrible person!" Well, don't worry about it, the Zara siggy will be back soon, new and improved! ^^ Meanwhile, just do what the sig tells you to. >.>

Offline

 

#7 2007-08-18 10:43:30

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: I would really like...

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)


Be nice, I'm an old lady  wink

Offline

 

#8 2007-08-18 11:42:43

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: I would really like...

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

 

Board footer