Jump to content

Confused about timing systems in Phaser


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.


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

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.

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.


  • Recently Browsing   0 members

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