Discuss Scratch

jess_is_awesome
Scratcher
5 posts

How do you pause a game?

I have no idea how to freeze the screen without using

stop [ v]
D-Mate19
Scratcher
100+ posts

How do you pause a game?

Try this
when [p] key pressed
switch backdrop to [ pause game backdrop]

Hen add this to your sprites
when backdrop switches to [ pause game backdrop]
stop [this script v]
Else

Last edited by D-Mate19 (March 24, 2016 20:09:50)

bastiaan1200
Scratcher
17 posts

How do you pause a game?

when [P v] key pressed
set [Pause v] to [ 1]
wait until <mouse down?>
set [Pause v] to [ 0]

In other sprite
wait until <[Pause] = [ 0]>

Last edited by bastiaan1200 (March 25, 2016 07:50:45)

Wong2016
Scratcher
24 posts

How do you pause a game?

bastiaan1200 wrote:

when [P v] key pressed
set [Pause v] to [ 1]
wait until <mouse down?>
set [Pause v] to [ 0]

In other sprite
wait until <[Pause] = [ 0]>
wait until <(Pause) = [ 0]>
_Mento_
Scratcher
6 posts

How do you pause a game?

Wong2016 wrote:

bastiaan1200 wrote:

when [P v] key pressed
set [Pause v] to [ 1]
wait until <mouse down?>
set [Pause v] to [ 0]

In other sprite
wait until <[Pause] = [ 0]>
wait until <(Pause) = [ 0]>
[/quote]
Yup

Last edited by _Mento_ (March 25, 2016 11:16:33)

gtoal
Scratcher
1000+ posts

How do you pause a game?

This is where good design pays off. If your code contains lots and lots of infinite loops, stopping everything is tricky. This is just one reason why most games are coded with one main loop that controls all the action. Then you have one place where you can easily insert a pause command.
DisneyArtz
New Scratcher
3 posts

How do you pause a game?

Put in anything:
when green flag clicked
forever

if <key [p v] pressed?> then
broadcast [pause v]

end

end

Put in pause screen:
when I receive [pause v]
show
go to front

when green flag clicked
hide

when green flag clicked
forever

if <key [space v] pressed?> then
hide

end

end

Put in all other sprites:
when [p v] key pressed
hide
wait until <key [space v] pressed?>
show
MA006
Scratcher
4 posts

How do you pause a game?

Why dosen't this work?
when I receive [ v]
if <key [ v] pressed?> then
if <[(pause)] = [0]> then
set [(pause) v] to [1]
end
if <(pause) = [1]> then
set [(pause) v] to [0]
end
end
deck26
Scratcher
1000+ posts

How do you pause a game?

MA006 wrote:

Why dosen't this work?
when I receive [ v]
if <key [ v] pressed?> then
if <[(pause)] = [0]> then
set [(pause) v] to [1]
end
if <(pause) = [1]> then
set [(pause) v] to [0]
end
end
Please start your own topic rather than necroposting.

Think through your script - what happens when you run it with pause = 0?
Mist_2019
Scratcher
5 posts

How do you pause a game?

D-Mate19 wrote:

Try this
when [p] key pressed
switch backdrop to [ pause game backdrop]

Hen add this to your sprites
when backdrop switches to [ pause game backdrop]
stop [this script v]
Else

what if I want to make sure that you can't move anything while the pause game backdrop is shown
like, for instance, if you have a sprite that constantly moves and points to your mouse, and you want it to stop moving to your mouse while the game is paused
notgoodatc0de
Scratcher
100+ posts

How do you pause a game?

Mist_2019 wrote:

D-Mate19 wrote:

Try this
when [p] key pressed
switch backdrop to [ pause game backdrop]

Hen add this to your sprites
when backdrop switches to [ pause game backdrop]
stop [this script v]
Else

what if I want to make sure that you can't move anything while the pause game backdrop is shown
like, for instance, if you have a sprite that constantly moves and points to your mouse, and you want it to stop moving to your mouse while the game is paused
I'm pretty sure that will happen because of the stop this script block. As long as you add it to the scripts, I think it should work (i don't know tho).
Oumuamua
Scratcher
1000+ posts

How do you pause a game?

Please do not revive old topics. Thanks

Below a pretty useful advice already posted in this topic

gtoal wrote:

This is where good design pays off. If your code contains lots and lots of infinite loops, stopping everything is tricky. This is just one reason why most games are coded with one main loop that controls all the action. Then you have one place where you can easily insert a pause command.
PartyFlamingo124
Scratcher
2 posts

How do you pause a game?

DisneyArtz wrote:

Put in anything:
when green flag clicked
forever

if <key [p v] pressed?> then
broadcast [pause v]

end

end

Put in pause screen:
when I receive [pause v]
show
go to front

when green flag clicked
hide

when green flag clicked
forever

if <key [space v] pressed?> then
hide

end

end

Put in all other sprites:
when [p v] key pressed
hide
wait until <key [space v] pressed?>
show

Thanks, this really usefull, I'll tell you if it works or not, also because I have 3.0
PartyFlamingo124
Scratcher
2 posts

How do you pause a game?

PartyFlamingo124 wrote:

DisneyArtz wrote:

Put in anything:
when green flag clicked
forever

if <key [p v] pressed?> then
broadcast [pause v]

end

end

Put in pause screen:
when I receive [pause v]
show
go to front

when green flag clicked
hide

when green flag clicked
forever

if <key [space v] pressed?> then
hide

end

end

Put in all other sprites:
when [p v] key pressed
hide
wait until <key [space v] pressed?>
show

Thanks, this really usefull, I'll tell you if it works or not, also because I have 3.0
1 thing: I do NOT have 0 posts, ok? I don't know why it says that. Yeah, it doesn't work at all, it basiccally makes everything disappear and the pause screen doesn't even come up.
BlueNoodle29
Scratcher
100+ posts

How do you pause a game?

Please do not necropost!
0874957
Scratcher
1 post

How do you pause a game?

This is NOT HELPING
Yeetoburro1
Scratcher
1000+ posts

How do you pause a game?

0874957 wrote:

This is NOT HELPING
Dude, this thread is from 2016
Mo_1_2
Scratcher
5 posts

How do you pause a game?

Hello
Vibrato
Scratcher
1000+ posts

How do you pause a game?

Mo_1_2 wrote:

Hello
Please don't post on old topics. You have just bumped someone needing help off the front page, making it far less likely for them to get help.

Powered by DjangoBB