liakos1992 Posted December 13, 2015 Share Posted December 13, 2015 By default, the desiredFps is 60, so the delta time (physicsElapsedMS) is 16.66 ms. Each 16.66 ms phaser update sprites based on velocity, gravity and other things with a function. How to capture this physics update function or implement a callback there? I want to try to make a custom physics system Link to comment Share on other sites More sharing options...
icp Posted December 13, 2015 Share Posted December 13, 2015 Multiply your custom sprite's velocity in the update loop with :* this.game.time.physicsElapsedExample : NameSpace.Game.prototype.update = function () { this.myCustomSprite.position.x += this.customVelocityX * this.game.time.physicsElapsed; this.myCustomSprite.position.x -= this.customVelocityY * this.game.time.physicsElapsed; } webdva 1 Link to comment Share on other sites More sharing options...
liakos1992 Posted December 13, 2015 Author Share Posted December 13, 2015 thank you. do you know how i can render everything AFTER the update loop? changes at x, y will not be seen until the next "update()" Link to comment Share on other sites More sharing options...
icp Posted December 13, 2015 Share Posted December 13, 2015 I'm not exactly sure, but I think you can take a look at docs and see which method fits your needs:http://phaser.io/docs/2.4.4/Phaser.Game.html#updateRender Link to comment Share on other sites More sharing options...
Recommended Posts