Jump to content

How to make time scale


Kether
 Share

Recommended Posts

How to make time scale with phaser?

I found "game.time.slowMotion" but it show time only and looks like frame drop

I need a smart way to set game 3 times faster or pause (except menu animation and click respond)  or slow like bullet time. And frame smooth of course

Is any one can help?

 

Link to comment
Share on other sites

27 minutes ago, samme said:

You need to turn off game.forceSingleUpdate and then match time.desiredFps to time.slowMotion. See 

 

This is great, thank you.

This code should add to Examples of phaser

Link to comment
Share on other sites

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

32 minutes ago, Kether said:

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.

I think that's the alpha tween, I turned it off.

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

 Share

  • Recently Browsing   0 members

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