Jump to content

How to make time scale


Kether
 Share

Recommended Posts

On 2017/7/21 at 0:59 AM, samme said:

You need to match time.desiredFps to time.slowMotion. See 

 

Thanks for update this example

A little problem, may be a bug, when the time is nearly stoped (physicsElapsedMS == 0), Particles stoped too, then change the time back, particles still stop.

Link to comment
Share on other sites

Stumbled across this thread as I'm looking to do something very similar.

One question if anyone can answer: Is it possible to make this also change the speed at which events are fired? So if slowMotion is set to 1/3 (0.3333 ish), an event that is scheduled for 3 seconds in the future changes to 1 second.

Maybe changing the value of Phaser.Timer.SECOND? And also iterating over each event already scheduled and changing when it is due to fire?

The use case for me would be a fast-forward mode that can be toggled on and off.

 

Link to comment
Share on other sites

I think the best solution is to make everything in your game time-dependant (and not frame-dependant), so that you can apply a special ratio to the elapsed time at any update. For example, if you want to speed up the game by 2, and the elapsed time since last update is 16ms, multiply it by 2 and do your calculations with 32 ms. That's what I do and I can get the whole world to slow down by any factor I want.

Link to comment
Share on other sites

3 hours ago, Skeptron said:

I think the best solution is to make everything in your game time-dependant (and not frame-dependant), so that you can apply a special ratio to the elapsed time at any update. For example, if you want to speed up the game by 2, and the elapsed time since last update is 16ms, multiply it by 2 and do your calculations with 32 ms. That's what I do and I can get the whole world to slow down by any factor I want.

Yes, I thought it, samme shows the way to change speed of physics and tween , I just need to change other speed like game logic loop

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...