Any projects that has one or a way to make one?
Offline
I've often wondered how to effectively do this. I'll look at that project also.
Offline
It's really as simple as putting a few broadcasts and a few extra sprites and scripts.
Offline
To make a drop-down menu:
Make a sprite that the drop-down menu comes from.
Then, make some more sprites that stack on top of each other with the stuff you want in the drop-down menu.
Then, make these scripts:
Sprite where drop-down menu comes from:
Script 1:
[blocks]
<when green flag clicked>
<forever>
<if><touching[ mouse-pointer
<broadcast[ whatever
<end>
<if> <<not> <<touching[ mouse-pointer
<broadcast[ whenever
<end>
[/blocks]
For pieces of drop-down menu:
Script 1:
[blocks]
<when green flag clicked>
<hide>
[/blocks]
Script 2:
[blocks]
<when I receive[ whatever
<show>
[/blocks]
Script 3:
[blocks]
<when I receive[ whenever
<hide>
[/blocks]
Last edited by Midmad (2009-10-04 20:28:02)

Offline
Or you could make a single sprite that stamps the options when expanded and clears when collapsed. More complicated and difficult but it helps avoid having too many sprites.
[blocks]
<when[ Menu sprite ]clicked>
<if><( Costume # <=> 1 )>
<next costume>
<stamp>
<repeat( whatever number of options there are)
<next costume>
<change y by( varies on size of menu things)
<stamp>
<end>
<go to x
whatever the original x position was )y
whatever the original y position was)
<switch to costume[ expanded]
<else>
<clear>
<switch to costume[ collapsed]
<go to x
whatever the original x position was )y
whatever the original y position was)
<end>
[/blocks]
You'll also need scripts so that Scratch can detect when the mouse is on each menu option and clicked. Something like if the mouse's x and y position is within certain parameters, if mouse down, wait until not mouse down, broadcast whatever.
Hope this helps.
Last edited by Harakou (2009-11-08 21:36:51)
Offline
AddZero has a really good dropdown menu.
http://scratch.mit.edu/projects/AddZero/134975
Last edited by Lucario621 (2009-11-08 21:40:02)
Offline