How do I continue a timer after i've reduice html5 page

Get help using Construct 2

Post » Wed Oct 07, 2015 9:27 am

Hello, i work a project where i've a timer game. When i play and i reduce my page, the timer (so dt) stopped because i'm not on this page. It is possible time continue whereas i'm not on game page.

Sorry for my bad english.

Thanks for your future answers.
B
7
S
1
Posts: 44
Reputation: 487

Post » Wed Oct 07, 2015 1:30 pm

Go to Project Properties and set Pause on unfocus to NO. Have to help.
B
9
S
1
Posts: 63
Reputation: 857

Post » Wed Oct 07, 2015 2:00 pm

MadScientist wrote:Go to Project Properties and set Pause on unfocus to NO. Have to help.


As far as I know this only works in preview..
When unfocused the game is always suspended..
There are some third party plugins like rex time away, that measure the time between unfocused and refocused..
Because there are no user inputted events in that time it should be possible to adjust everything based on the time passed..
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 » Wed Oct 07, 2015 2:07 pm

Agree with littlestain. When the html page is not infocus (i.e minimized) the game stops.

Only option is 3rd party plugins or some custom hacks.
You think you can do these things, but you can't, Nemo!
Just keep reading.
Just keep learning.
B
65
S
16
G
9
Posts: 1,429
Reputation: 12,708

Post » Wed Oct 07, 2015 2:14 pm

ok, thanks for your answers and I check plugin
B
7
S
1
Posts: 44
Reputation: 487

Post » Thu Oct 08, 2015 10:13 am

Ok it's work fine. Thanks for plug rex time away suggestions. Combine by browser function such as "suspend on" and "resume on" and webStorage plug, my problem is resolved.

code for timer 95 at 0 :
Global number GameTimer = 95;

(browser | on suspend) then (TimeAway | start timer "timer")
(browser | on resumed) then (System | set GameTimer to GameTimer-TimeAway.ElapsedTimer("timer")
TimeAway | removeTimer "timer")

(blank) then (System | set GameTimer to GameTimer - dt)

(System | every 1.0 second) then (Text | setText to str(int(TimerGame)))
B
7
S
1
Posts: 44
Reputation: 487


Return to How do I....?

Who is online

Users browsing this forum: Darth Crusher, ketramtu18, Syazanie Amirin, XMatrix and 9 guests