This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-03-21 16:13:47

OwnedU2Fast
New Scratcher
Registered: 2012-03-07
Posts: 1

Pause and Resume All Scripts

I am making a game. When I press p, I want a pause menu to pop up. Now, I have already done that, but when I open the pause menu, I want it to stop all scripts. I cannot use the "Stop All" block because then I am forced to resume all scripts using the green flag, and it can be problematic as many of my sprites have scripts that are not started with the green flag. Is there a way that I can "Resume All?"

Offline

 

#2 2012-03-21 16:26:26

turkey3
Scratcher
Registered: 2011-12-04
Posts: 500+

Re: Pause and Resume All Scripts

Do this in one sprite:

When gf clicked
Broadcast [whatever v]
Forever
Wait until <key [s] pressed?>
Broadcast [pause v]
Wait (0.2) seconds
Wait until <key [s] pressed?>
Broadcast [whatever v]
Wait (0.2) seconds
Then have this in all the sprites you want stopping:
When I receive [whatever v]
Repeat until <key [s] pressed?>
Action goes here

Last edited by turkey3 (2012-03-21 18:03:15)

Offline

 

#3 2012-03-21 17:58:38

wolfdude999
Scratcher
Registered: 2012-01-07
Posts: 1000+

Re: Pause and Resume All Scripts

What I do is have a variable that is called mode and then when you press p or a pause button is clicked then it will set the mode to pause.  Then you can have your scripts that you want to stop in a forever loop and only have them run if mode = play.

If you want an example then download my project Project Trinity v.0.2 and look at it.

Last edited by wolfdude999 (2012-03-21 20:01:33)


http://i48.tinypic.com/15yxmp4.png

Offline

 

#4 2012-03-21 18:00:01

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Pause and Resume All Scripts

Or you could create a variable which is changed by pressing the pause button - then on the sprites in the game, make them wait until the pause variable = unpaused state before continuing with their actions. I think i have used that in one of my games  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#5 2012-07-12 08:34:39

Blayer98
Scratcher
Registered: 2012-03-22
Posts: 100+

Re: Pause and Resume All Scripts

i'm also having the same problem.

most of the game i'm creating, (It's a SCRATCH version of "The Sims") never involves pressing keys. just mouse clicking.

When i press pause mode, it stops scripts, but when i click live mode, they don't resume! plus, there would be sounds playing too.

Can you please help me?

Kudos for anyone that can help!


http://i50.tinypic.com/16lwmlj.png
The first Collab to have it's very own Cloud Variables! Coming Soon!

Offline

 

Board footer