Jump to content

Confused about timing systems in Phaser


Cola_Colin
 Share

Recommended Posts

So I am building a game where I for some parts use tweens that interact with gameplay. Other parts of the gameplay are based on time.physicsElapsed.

I believe using time.physicsElapsedfor every frame (call to update) should cause the gameplay to slow down together with the fps, which is what I'd like to have as I have decided that is the most graceful way to deal with weak devices.

What I am confused about is how tweens are timed. 

http://phaser.io/docs/2.6.2/Phaser.TweenManager.html#frameBased makes it look like only frameBased Tweens are using the physics time and that isn't the default setting.

http://phaser.io/docs/2.6.2/Phaser.Time.html explains that Physics Time is used for tweens. Which seems to contradict the above finding.

So if I combine tweens with other timings that work on counting time.physicsElapsedin each update() call will that work consistently or not? I am worried that fps drops will slow down some parts of the gameplay, but not others. Do I need to switch the tween manager to use frameBased tweens if I want it to stay in sync with the rest of the physics time in low fps situations or not?

Link to comment
Share on other sites

Okay, thanks I'll do that then.

EDIT:

Turns out the documentation of http://phaser.io/docs/2.6.2/Phaser.Tween.html#to isn't fully correct. It states this about the duration:

" Duration of this tween in ms. Or if Tween.frameBased is true this represents the number of frames that should elapse. "

Even if Tween.frameBased is true the duration still has to be passed as a ms value, not as a number of frames. That's nice and makes handling this easier, the documentation appears to be misleading here. The only difference due to frameBased is here I think: https://github.com/photonstorm/phaser/blob/v2.6.2/src/tween/TweenData.js#L370 and that's the difference I want. :)

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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