How do I Pause game for x Seconds

Get help using Construct 2

Post » Thu Jun 16, 2016 10:55 pm

I want to pause the game for a second or so, such as when a player picks up an item or some other quick event:

function pause (setting timeframe to 0 and disabling events/groups)
something else
wait 1 second
function unpause

Problem is that with a timescale 0 the 1 second will never pass.

I guess I could set timescale to zero then set a specific object with a timer to timescale 1 and start the timer...but I feel like there should be a simpler solution without creating unnecessary objects...
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Thu Jun 16, 2016 11:50 pm

I suppose you can use wait for signal instead?
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Jun 17, 2016 12:07 am

FraktalZero wrote:I suppose you can use wait for signal instead?


I don't see how that would help as you would still have the same issues just in a different event.
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Fri Jun 17, 2016 12:12 am

without using the timescale. On my project I simply did it via animation and waiting for a signal + states.
B
43
S
12
G
14
Posts: 488
Reputation: 10,570

Post » Fri Jun 17, 2016 12:34 am

You could also maybe not *completely* pause the game... just set timescale to a very low amount (like 0.001 - or something) and have a wait time there to suit. It would be such slow motion it would appear paused, but not really be paused. Maybe?

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
81
S
34
G
40
Posts: 3,032
Reputation: 30,424

Post » Fri Jun 17, 2016 2:57 am

@badmoodtaylor Have you use tag before ?
I dont have C2 with me now...So maybe I kinda miss something but.
Set a " tag" to pause
then wait for a signal = the " tag"
B
13
S
5
G
4
Posts: 119
Reputation: 3,353

Post » Fri Jun 17, 2016 10:51 am

fathijack1999 wrote:@badmoodtaylor Have you use tag before ?
I dont have C2 with me now...So maybe I kinda miss something but.
Set a " tag" to pause
then wait for a signal = the " tag"


I'm familiar with wait for signal but I'm not sure what solution you are suggesting.
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Fri Jun 17, 2016 10:58 am

SoldjahBoy wrote:You could also maybe not *completely* pause the game... just set timescale to a very low amount (like 0.001 - or something) and have a wait time there to suit. It would be such slow motion it would appear paused, but not really be paused. Maybe?

~Sol


This makes sense and will give it a try. Don't even have to do the math myself, just times it my timescale (wait 2 seconds: 2*timescale).

Thank you

I guess the only concern I can think of is I have my gameplay events disabled (all in a group that is deactivated while paused) and one of my timers does happen to hit in that microsecond. Seems low percentage but still possible. The event for the timer would be disabled. Is there a way to pause all timers? Or would you have pause each individual objects timer? A for loop for each active timer would be good if that's possible to do.
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913

Post » Fri Jun 17, 2016 12:56 pm

also...

System expressions wrote:wallclocktime
The number of seconds since the game started, not taking in to account the time scale (i.e. the real-world time).



Image
Image
B
64
S
23
G
7
Posts: 1,483
Reputation: 10,827

Post » Fri Jun 17, 2016 4:01 pm

@korbaach yes, that sounds like the simple straightforward solution that I thought I must have been missing

I'm not at home to try it out right now but I am pretty confident that is the best solution and won't cause any issues. Thanks!


Side note: I'm surprised that googling "Construct 2 wallclocktime/wall clocktime" doesn't have any helpful top results such as the System Expression page. If you didn't note there that it was from the system expressions page I would not have found it. I find it very difficult to find the desired material whether it be from Scirras internal search or external/google search.
ImageImageImage
B
39
S
22
G
11
Posts: 486
Reputation: 9,913


Return to How do I....?

Who is online

Users browsing this forum: jasontoups and 3 guests