0 Favourites

How do I pause game with every tick ?

  • hi,

    i want to know how can i do pause game with very tick

    explain :

    iam using every tick ---- set x of background to background.X-5

    but when i when to make pause (by set time scale to 0) the game is pause but the background stil move

    thanks

  • Why not set a variable when you pause, then set a condition

    if variable <> 1 ......do every tick

  • Put a condition that says if timescale not equal to 0 then set x background, etc....

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • hi,

    i want to know how can i do pause game with very tick

    explain :

    iam using every tick ---- set x of background to background.X-5

    but when i when to make pause (by set time scale to 0) the game is pause but the background stil move

    thanks

    if instead of doing set x of background to background.X-5, you do set x of background to background.X-5*60*dt, not only the pause will work, but also if the framerate takes a hit during gameplay, the speed of the background in pixels/sec will not be affected.

  • > hi,

    > i want to know how can i do pause game with very tick

    >

    > explain :

    >

    > iam using every tick ---- set x of background to background.X-5

    > but when i when to make pause (by set time scale to 0) the game is pause but the background stil move

    >

    > thanks

    >

    if instead of doing set x of background to background.X-5, you do set x of background to background.X-5*60*dt, not only the pause will work, but also if the framerate takes a hit during gameplay, the speed of the background in pixels/sec will not be affected.

    FANSTASTIC , EXCELLENT

    i dont know how to thank you

    that work ... and the "X-5*60*dt" save performance and optimisation on iphone 4

    now work fine and i solve my problem regarding iphone 4 (you remember in another post)

  • >

    > > hi,

    > > i want to know how can i do pause game with very tick

    > >

    > > explain :

    > >

    > > iam using every tick ---- set x of background to background.X-5

    > > but when i when to make pause (by set time scale to 0) the game is pause but the background stil move

    > >

    > > thanks

    > >

    >

    > if instead of doing set x of background to background.X-5, you do set x of background to background.X-5*60*dt, not only the pause will work, but also if the framerate takes a hit during gameplay, the speed of the background in pixels/sec will not be affected.

    >

    FANSTASTIC , EXCELLENT

    i dont know how to thank you

    that work ... and the "X-5*60*dt" save performance and optimisation on iphone 4

    now work fine and i solve my problem regarding iphone 4 (you remember in another post)

    the "*60*dt" to make something vary is pretty handy (most C2's behaviors use it without telling it):

    when you move something every tick by 5 pixels, it will move of 5 pixels every tick, if the game has slowdown, a tick isn't as fast as a framerate of 60 fps (where duration of a tick is 1/60 in that case).

    dt is the time between each tick in seconds, for instance, if you add dt to a variable every tick, it'll increase of 1 each seconds, regardless of the framerate (exception if the framerate goes below 10 fps, but having 10 fps would imply more problems of course anyway)

    adding 5*60*dt (=300*dt) means that at the end your tiled background each seconds will have travelled 300 pixels (5 pixels each 1/60 of seconds), regardless of the framerate

    As I stated, with the execption of physics, every behavior I think uses that without you knowing it (this explains that they ask for a speed in px/s, and acceleration in px/s², and so on..).

  • hi aphrodite

    with your tricks i get excellent performance on iphone 4s

    on iphone 4 , before i do your trick it was very very slow ... now with your trick it goes little faster than iphone 4S you understand me ?

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