Discuss Scratch

HappyLittleHuntress
New Scratcher
2 posts

How to make a selection of sprites then only show the one you picked?

I want to make an adventure game and you can choose your character. However I don't know how you can make the other characters go away after the player's picked their sprite. Please help with my programming. I have four characters and I choose one how do I make the other characters go away so you only have one character to play as? Please help me.
deck26
Scratcher
1000+ posts

How to make a selection of sprites then only show the one you picked?

If the characters behave in the same way I'd use a single sprite with multiple costumes. You can use cloning or stamping to choose which costume you want. https://scratch.mit.edu/projects/41719938/ might help.

If the characters have different patterns of behaviour you just need to have a variable that records which sprite you selected and hide the ones that aren't selected - probably with a broadcast.
Letsgopitt
Scratcher
500+ posts

How to make a selection of sprites then only show the one you picked?

You might also be able to use variables for this. Watch:
when I receive [character select v]
wait until <<mouse down?> and <<touching [mouse pointer v] ?> >>
set [character v] to [character selected ]
when green flag clicked
wait until <(character selected) = [<<x> or <y >> ]> // For all your characters
then have the actions the characters must do
Please tell me if I have misinformed you!
deck26
Scratcher
1000+ posts

How to make a selection of sprites then only show the one you picked?

Another option would be to only show one costume at a time but use the left/right arrow keys to show the previous/next one. Only allow the keys to do that at a particular stage (backdrop=…… or gamestarted=0 or something).
TheFriendliestDerp
Scratcher
100+ posts

How to make a selection of sprites then only show the one you picked?

Here's something I found extremely useful. You do need a character Variable though.

switch costume to [(Character) ]

Last edited by TheFriendliestDerp (May 13, 2015 14:51:08)

HappyLittleHuntress
New Scratcher
2 posts

How to make a selection of sprites then only show the one you picked?

Thanks for all your comments so far i really appreciate it!!!
pianogirl84
Scratcher
1000+ posts

How to make a selection of sprites then only show the one you picked?

Sounds like you need to broadcast a message. When the one sprite is clicked,it broadcasts a message that makes the other sprites hide. Hope this helps.
GuyOfCoding
Scratcher
66 posts

How to make a selection of sprites then only show the one you picked?

Try using this:

when this sprite clicked
broadcast [character 1 selected v]


when I receive [character 1 selected v]
hide
GuyOfCoding
Scratcher
66 posts

How to make a selection of sprites then only show the one you picked?

Repeat this however many times you need but always make another message every time you add a character.
noahdvir
New Scratcher
1 post

How to make a selection of sprites then only show the one you picked?

thanks for the advise!

Powered by DjangoBB