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

#1 2009-08-20 19:14:50

Quasar323
Scratcher
Registered: 2009-04-29
Posts: 12

Making a pause script

I was wondering how I would make a pause script for a game im making.


http://i474.photobucket.com/albums/rr106/Vorbix/AreaMakerBanner.png

Offline

 

#2 2009-08-20 21:17:00

mb1350
Scratcher
Registered: 2009-03-25
Posts: 9

Re: Making a pause script

I just came up with a fairly rudimentary way to pause:

Have a sprite with the following script:

<when green flag clicked>
<forever>
<if><key[ p ]pressed?>
<show>
<stop all>


After that have the same sprite with a script that broadcasts a 'resume' message when clicked.

From here it might get a little difficult to get things proceeding as if they were uninterrupted, but if you play around with it you should be able to pull something out.

Offline

 

#3 2009-08-21 07:41:48

TheSaint
Scratcher
Registered: 2008-11-04
Posts: 1000+

Re: Making a pause script

^ That way shuts down the entire game.
When you make a pause button, have it set a variable to 1 if paused and 0 if not paused. Then, on any forever, repeating or wait scripts just put right inside them but around everything else,
<if> Pause =0

This makes it so that it will only run while the game is unpaused.

Hope that was clear enough!

Offline

 

#4 2009-08-21 18:45:44

Quasar323
Scratcher
Registered: 2009-04-29
Posts: 12

Re: Making a pause script

TheSaint wrote:

^ That way shuts down the entire game.
When you make a pause button, have it set a variable to 1 if paused and 0 if not paused. Then, on any forever, repeating or wait scripts just put right inside them but around everything else,
<if> Pause =0

This makes it so that it will only run while the game is unpaused.

Hope that was clear enough!

I did the thing with the variables, but it might of been a different way, all i remember it
that it didn't work


http://i474.photobucket.com/albums/rr106/Vorbix/AreaMakerBanner.png

Offline

 

#5 2009-08-21 18:50:05

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Making a pause script

If  forever if(pause =0) did not work, then you are doing it wrong. You can't do it any other way.

Just put forever if(pause=0) on top of all your scripts and set pause to 1 if you want to pause.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#6 2009-10-11 16:41:21

dwighthoward
Scratcher
Registered: 2009-10-11
Posts: 2

Re: Making a pause script

i can get everything on my screen to stop...but i canot get it to play again without making it go back to the beginning -.- please help!

Offline

 

#7 2009-10-12 00:15:54

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Making a pause script

Can you post a link to what your game is? Be more specific?


Hai.

Offline

 

#8 2009-10-21 09:44:52

justtestingstickman
Scratcher
Registered: 2009-07-04
Posts: 100+

Re: Making a pause script

archmage wrote:

If  forever if(pause =0) did not work, then you are doing it wrong. You can't do it any other way.

Just put forever if(pause=0) on top of all your scripts and set pause to 1 if you want to pause.

You can also use wait until <pause=0>


http://img509.imageshack.us/img509/2126/smalladvert.pnghttp://img175.imageshack.us/img175/8867/advertisementfor3sprite.pnghttp://img696.imageshack.us/img696/6061/failc.png
This signature has too many lines.

Offline

 

#9 2009-10-31 22:34:09

holden012
Scratcher
Registered: 2009-10-31
Posts: 3

Re: Making a pause script

archmage wrote:

If  forever if(pause =0) did not work, then you are doing it wrong. You can't do it any other way.

Just put forever if(pause=0) on top of all your scripts and set pause to 1 if you want to pause.

It Did'nt Work either

Offline

 

Board footer