Discuss Scratch

Vzwhu
Scratcher
6 posts

How do I make a script "switch around"?

So, currently, I am making a Hide and Seek game on Scratch, and I made an option to choose whether you're a hider or a seeker. But, I have a slight problem, I'm trying to make it so that when you choose the seeker/hider option, it will freeze you for 10 seconds, so the other person/bot can have to to get away and hide. So, if you choose the hider option, the bot will be frozen for 10 seconds, and if you choose the seeker option, you will be frozen for 10 seconds. But, I just can't figure out how to do it. If you know the answer, please send it to me!
mysterious-neutron
Scratcher
1000+ posts

How do I make a script "switch around"?

In the seeker button add this:
when this sprite clicked
set [player mode v] to [seeker]

In the hider button add this:
when this sprite clicked
set [player mode v] to [hider]

In the bot add this script when you wan it to freeze
if <(player mode)=[hider]> then
wait [10] secs
end
do all the movement scripts you have ::grey

In the player add this script when you wan it to freeze
if <(player mode)=[seeker]> then
wait [10] secs
end
do all the movement scripts you have ::grey
ThorstenKettner
New Scratcher
7 posts

How do I make a script "switch around"?

I'd expect a variable visible to all sprites

(Player is what)

Then broadcast a freeze message when you choose:

if <(Choice) = [seeker]> then 
set (Player is what) to [seeker]
else
set (Player is what) to [hider]
end
broadcast [freeze]

React on the freeze message in the player sprite;

when I receive [freeze]
if <(Player is what) = [seeker]> then
wait (10) secs
end

React on the freeze message in the bot sprite;

when I receive [freeze]
if <(Player is what) = [hider]> then
wait (10) secs
end

Vzwhu
Scratcher
6 posts

How do I make a script "switch around"?

Thank you so much all of you!!

Powered by DjangoBB