In a game I'm trying to create, I use the letters of the alphabet as individual sprites. When you click one to choose it, I want it to switch to another costume and have all other letters disappear.
There is a separate sprite - the hero - who should stay even after the letter is chosen. Can anyone help me do this?
If I broadcast hide, even the letter chosen gets hidden, so that doesn't work...
Thanks!
- total newbie
Offline
One way to do this is to make a variable called "chosen".
Set it to 0 by default and define a number for each letter such as 1 for 'A', 2 for 'B', 3 for 'C', etc. When a letter is chosen, set the variable to the number of that letter and broadcast hide. Each letter should check if the variable is set to their 'personal number' and if it isn't, hide. The only letter that should remain unhidden is the one you have chosen.
[blocks]
<when[ letter ]clicked>
<set{ chosen }to( personal number
<broadcast[ hide
<when I receive[ hide
<if><not> <( <{ chosen }> <=> personal number )> >>
<hide>
<end>
[/blocks]
Offline
listen to RedNeptune and you'll be fine.
Offline
reillydow wrote:
thanks! how do I set a personal number for each sprite?
You do that in the 2nd script. When it says [blocks]<if><not> <( <{ chosen }> <=> personal number )> >>[/blocks]
, that's how you're setting the number. You're basically saying "If it isn't x number, hide." You change the number for each sprite, which is giving it a personal number
Offline
If you mean how to make a personal variable, go here.
Offline
reillydow wrote:
hello again
i followed MyRedNeptune's instructions but the other sprites don't hide when I click one... andy ideas?
As long as each of the personal numbers is unique and there aren't any other show blocks that might be causing the sprites to remain visible, it should work.
Offline
reillydow wrote:
hello again
i followed MyRedNeptune's instructions but the other sprites don't hide when I click one... andy ideas?
Is this exactly what your scripts look like, except with the numbers changed for each individual sprite?
Offline
gettysburg11 wrote:
reillydow wrote:
hello again
i followed MyRedNeptune's instructions but the other sprites don't hide when I click one... andy ideas?Is this exactly what your scripts look like, except with the numbers changed for each individual sprite?
http://i53.tinypic.com/2v989i9.jpg
If you use a forever if instead of the the if the script will be able to be used multiple times. Another way to do this is to make 26 different broadcasts for each letter and when the letter clicked you activate the letters broadcast and it will make all the other letters vanish unless u don't want them to.
Offline
emboar30 wrote:
gettysburg11 wrote:
reillydow wrote:
hello again
i followed MyRedNeptune's instructions but the other sprites don't hide when I click one... andy ideas?Is this exactly what your scripts look like, except with the numbers changed for each individual sprite?
http://i53.tinypic.com/2v989i9.jpgIf you use a forever if instead of the the if the script will be able to be used multiple times. Another way to do this is to make 26 different broadcasts for each letter and when the letter clicked you activate the letters broadcast and it will make all the other letters vanish unless u don't want them to.
Gettysburg's is simpler and that's the kind of thing I often use
Offline
I know - I mentioned it as an alternative method
Offline