Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with pausing
- scamper_se
- Scratcher
2 posts
Help with pausing
How do I make the scripts to pause the game? I made few games, but I want to add pause to the games.
Thank you
Thank you
- andre_rifaut
- Scratcher
100+ posts
Help with pausing
If there would be a “pause all” just like the “stop all” this would be easy.
Without that you have to pause yourself each active sprite, clones, the “timers” if you use them, …
It would be difficult to provide to the user the possibility to pause at any time.
One way to provide a pause functionality , is to design your game with specific phases that allow a possible pause.
This is highly dependent on the game.
Different ways to do this are the following:
1) You can design your game so that the red flag (or the use of “stop all”) would put the game in a state that can be restared with the green flag (or a global message “restart” for instance). Note that in this case, the clones will be irremediably “killed”, so do not do that when clones are necessary.
2) Allow your game to store its full state in a string variable or a list. In that case the state of the game could be restored later. If you store it in a cloud var, you can use that to pause the game for a number of days.
3) Insert in all scripts a “wait until” with the pause condition. If your game is well designed you should be able to minimize the number of scripts containing the “wait until”.
In all case, you will not be able to have a perfect real-time synchronization between all scripts pauses.
This is a difficult problem.
Without that you have to pause yourself each active sprite, clones, the “timers” if you use them, …
It would be difficult to provide to the user the possibility to pause at any time.
One way to provide a pause functionality , is to design your game with specific phases that allow a possible pause.
This is highly dependent on the game.
Different ways to do this are the following:
1) You can design your game so that the red flag (or the use of “stop all”) would put the game in a state that can be restared with the green flag (or a global message “restart” for instance). Note that in this case, the clones will be irremediably “killed”, so do not do that when clones are necessary.
2) Allow your game to store its full state in a string variable or a list. In that case the state of the game could be restored later. If you store it in a cloud var, you can use that to pause the game for a number of days.
3) Insert in all scripts a “wait until” with the pause condition. If your game is well designed you should be able to minimize the number of scripts containing the “wait until”.
In all case, you will not be able to have a perfect real-time synchronization between all scripts pauses.
This is a difficult problem.
- MasterCard786
- Scratcher
100+ posts
Help with pausing
If there would be a “pause all” just like the “stop all” this would be easy.
Without that you have to pause yourself each active sprite, clones, the “timers” if you use them, …
It would be difficult to provide to the user the possibility to pause at any time.
One way to provide a pause functionality , is to design your game with specific phases that allow a possible pause.
This is highly dependent on the game.
Different ways to do this are the following:
1) You can design your game so that the red flag (or the use of “stop all”) would put the game in a state that can be restared with the green flag (or a global message “restart” for instance). Note that in this case, the clones will be irremediably “killed”, so do not do that when clones are necessary.
2) Allow your game to store its full state in a string variable or a list. In that case the state of the game could be restored later. If you store it in a cloud var, you can use that to pause the game for a number of days.
3) Insert in all scripts a “wait until” with the pause condition. If your game is well designed you should be able to minimize the number of scripts containing the “wait until”.
In all case, you will not be able to have a perfect real-time synchronization between all scripts pauses.
This is a difficult problem.
Can you make this pausing thing on my scratch project which is called Animation Matter Science (REMIX)
Check these: APEX NEWS ISSUE 2 - http://scratch.mit.edu/projects/20648596/
And the amazing square - http://scratch.mit.edu/projects/20741133/
- scubajerry
- Scratcher
1000+ posts
Help with pausing
This project shows simple examples of pausing. The variable one is probably the easiest. Accoridng to the complexities of your project, they may not be perfect.
- legoman23392
- Scratcher
52 posts
Help with pausing
if <If you have a script like this,
[scratchblocks]
when green flag clicked
forever
if <> then
end
end
[/scratchblocks]> then
end[scratchblocks]
if <> then
if <> then
if <> then
if <> then
else
wait until <>
repeat until <>
repeat until (mouse y)(mouse y)<key [ v] pressed?>
ask <color [#f0f] is touching [#0f0]?> and wait
end
end
end
end
end
end
end
[/scratchblocks]
- Discussion Forums
- » Help with Scripts
- » Help with pausing