Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a script "switch around"?
- Vzwhu
-
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
-
1000+ posts
How do I make a script "switch around"?
In the seeker button add this:
In the hider button add this:
In the bot add this script when you wan it to freeze
In the player add this script when you wan it to freeze
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
-
7 posts
How do I make a script "switch around"?
I'd expect a variable visible to all sprites
Then broadcast a freeze message when you choose:
React on the freeze message in the player sprite;
React on the freeze message in the bot sprite;
(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
- Discussion Forums
- » Help with Scripts
-
» How do I make a script "switch around"?