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

0 favourites
  • 6 posts
From the Asset Store
Template for making an interactive book or a simple story book
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Go to Project Properties and set Pause on unfocus to NO. Have to help.

  • 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..

  • 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.

  • ok, thanks for your answers and I check plugin

  • 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)))

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)