How do I resume game after x seconds?

Just started using Construct 2? Post your questions here

Post » Sun Jul 26, 2015 11:10 am

Hi everyone,

I have included an event to pause game where on click object, system: set time scale to 0

I want to be able to resume to game after a few seconds after player clicks on the resume button.

I set system: wait 5 seconds followed by system: set time scale to 1.0 but the screen just froze there.

Is there a way to work around this?
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Sun Jul 26, 2015 12:48 pm

Add the timer behavior to the resume button (or any object) and when you set the global time scale to 0 you can set the timer object's time scale to 1 so that the timer can still run. Then you can use that timer to resume after 5 seconds.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Sun Jul 26, 2015 1:15 pm

@ramones. Thanks for explaining. I still don't really get how it works though. I have added the timer behavior but the game resumes right away, not after 5 seconds after I click the resume button. If you don't mind, a simple capx will be of great help.
Last edited by mrneko on Sun Jul 26, 2015 1:44 pm, edited 1 time in total.
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Sun Jul 26, 2015 1:36 pm

on button clicked - set timer for 5 seconds

on timer - game resume
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 26, 2015 1:44 pm

@LittleStain.

Is on timer part of system? Can't find it anywhere.
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Sun Jul 26, 2015 1:49 pm

It will be part of the conditions of the object you have given the timer behaviour..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 26, 2015 2:09 pm

@Littlestain

@ramones

I just made it work but it doesn't seem to be what I intended to do.

I tried the following:

ON Pause button: Set time scale to 0
Set Resume button time scale to 1

On Resume button: Set Timer "resume" for 3 (Once)

On Timer "resume: System set time scale to 1

and also this:

ON Pause button: Set time scale to 0

On Resume button: Set Resume button time scale to 1
Set Timer "resume" for 3 (Once)

On Timer "resume": System set time scale to 1

It's still stuck when I click on the Resume button.

The only one that works is this:

ON Pause button: Set time scale to 0
Set Resume button time scale to 1
Set Timer "resume" for 3 (Once)

On Timer "resume": System set time scale to 1

However, the game resumes on its own without pressing the Resume button after 3 seconds.
Last edited by mrneko on Sun Jul 26, 2015 2:49 pm, edited 1 time in total.
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Sun Jul 26, 2015 2:38 pm

Are the resume button and the pause button at the same location?
Because that would mean that when you touch the pause button, you automatically also touch the resume button and the timer is started..

I'm guessing that you are setting the timescale to 1 on timer resume, instead of 0 like you type?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests