First I would try to verify the game loop actualFps
and delta
values.
Can you tell what’s running faster or slower — frame animations, physics, tweens?
First I would try to verify the game loop actualFps
and delta
values.
Can you tell what’s running faster or slower — frame animations, physics, tweens?
Sorry, I am new to Phaser and would like to know how to get these values ??
My codes are similar in a way that I will have the
var config ={…}
var game = new Phaser.Game(config);
I tried this.game.actualFps, game.time.actualFps,this.actualFps,this.time.actualFps and it doesn’t work. Console log these and it shows “undefined” or jus pops out an error message “Cannot read properties of undefined (reading ‘actualFps’)”
In your first scene do console.log(this.game.loop)
once and then verify that targetFps
is 60
and raf.isSetTimeOut
is true
.
In scene update look at this.game.loop.delta
and this.game.loop.actualFps
.
Hi ! Thank You and Sorry for the late reply. The reason fps: { forceSetTimeOut: true, target: 60 } does not work was because I was using an old ver of Phaser. (ngl i felt v stupid whn this was the reason)
None of Phaser’s timing (except Matter Physics, sometimes) depends directly on the browser animation rate, so you shouldn’t usually have to limit the game step rate to fix timing problems. If you’re doing your own time logic, make sure you’re using delta
in the scene update()
or similar callbacks.
If you do want to limit FPS, there are two ways:
new Phaser.Game({
fps: {
limit: 33,
target: 30
}
});
new Phaser.Game({
fps: {
forceSetTimeOut: true,
target: 30
}
});
fps: { target: 60, min: 30, max: 120, smoothStep: true },