Cola_Colin Posted September 13, 2016 Share Posted September 13, 2016 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 More sharing options...
samme Posted September 13, 2016 Share Posted September 13, 2016 Tweens use Game Time unless set otherwise. You can use game.tweens.frameBased = true; Link to comment Share on other sites More sharing options...
Cola_Colin Posted September 13, 2016 Author Share Posted September 13, 2016 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. samme 1 Link to comment Share on other sites More sharing options...
samme Posted September 14, 2016 Share Posted September 14, 2016 That's good since I was dreading converting all my tweens to frame-based. Link to comment Share on other sites More sharing options...
Recommended Posts