Pause Function

Get help using Construct 2

Post » Thu Nov 03, 2011 4:19 pm

Even though I searched a lot on the forums, i'm still having problems with time scale 0 when pausing the game

I mean, I'm making a platformer like Megaman for ex. and when I pause the game, everything pauses, cool, but I can still shoot with my weapon even though the bullets wont move

It feels like a time stop thing where I can shoot hundreds of bullets and they will only move after the time is running again, its funny but not what I want...

I'm using On Shot key pressed > spawn object bullet

I read about the time delta things but I could not figure it out how to make it work in this case =/...

I'm also having this problem while I press left and right key, the sprite is changing it's facing direction, which looks weird, since the game should be paused... anyway

Any help is appreciated.


So just making sure: what I want is that when time scale = 0, I cant just shoot bullets at all, so they dont spawn.
B
11
S
2
G
2
Posts: 7
Reputation: 1,511

Post » Thu Nov 03, 2011 4:26 pm

-+ Global variable paused = 0
->On Shot key pressed > spawn object bullet

With the on shoot as a sub event to the comparison, it wont be triggered if the variable is not equal to 0.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Nov 03, 2011 4:26 pm

I usually place all my events in Groups, then I can use the 'System: Set Group Active' event to enable disable everything in one go.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
120
S
28
G
68
Posts: 4,844
Reputation: 48,289

Post » Thu Nov 03, 2011 4:40 pm

Oh thanks, I totally forgot I could use a variable to do that

Really thanks a lot.

Sorry for beign noob >_>

About the groups, that's a nice idea also, thanks gonna re-think everything here from now on.
B
11
S
2
G
2
Posts: 7
Reputation: 1,511

Post » Thu Nov 10, 2011 7:43 pm

Isnt possible by setting the time scale down to zero?
Like:
Keyboard > on P pressed
System > Set time scale to 0.

The thing is, I cant switch back on again if pressing P again. Bummer. Im a huge noob.
B
18
S
4
G
5
Posts: 149
Reputation: 4,498

Post » Fri Dec 02, 2011 9:07 am

Hi, I make a "Pause" plugin. Maybe it can help you.rexrainbow2011-12-02 09:14:40
B
97
S
22
G
178
Posts: 4,118
Reputation: 104,043

Post » Fri Dec 02, 2011 9:58 am

Pausing

Set the time scale to 0 and the game will come to a halt, since game-time is frozen. However, the framerate is not affected, and events continue to run. This can allow you to control a pause-menu or allow other commands to be carried out while the game is paused.


More on time scaling here.

Basically, yes, deactivate certain groups when pausing!
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Fri Dec 02, 2011 2:25 pm

From the Delta-time and framerate independence tutorial:

[quote]You can set the time scale to 0. This stops all motion. It's an easy way to pause the game. Set it back to 1 and the game will resume.

You might notice you can still do things like shoot using the game controls. You can get around that by putting your main game events in a group, and activating/deactivating that group as you pause and unpause.[/quote]
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Sat Sep 14, 2013 11:38 am

https://www.scirra.com/tutorials/646/advanced-game-pausingDan722013-09-14 11:40:27
B
31
S
12
G
3
Posts: 16
Reputation: 5,466

Post » Thu Oct 24, 2013 1:37 am

I also found it helpful to set:

Platform Disabled (pause)
Platform Enabled (unpause)

Otherwise on my platformer game I could be in a paused state, hit the jump button, hit unpause and see my player sprite jump.
B
10
S
4
G
1
Posts: 10
Reputation: 997

Next

Return to How do I....?

Who is online

Users browsing this forum: armaldio, blackhornet, ETgirl79, TiagoCesar, Yahoo [Bot] and 18 guests