Hi, i wanted to make a slow mo effect in my game
Something that will effect the update function the tweens and the animations of my scene
This means sending ‘wrong’ values of delta time for all those objects internally
Hi @ProperSag,
The scene has three members with the timeScale property. So if you would like to reduce the speed of the scene by half:
this.tweens.timeScale = 0.5; // tweens
this.physics.world.timeScale = 0.5; // physics
this.time.timeScale = 0.5; // time events
Regards.
Thank you! it worked
there is also
this.anims.globalTimeScale = 0.5
it requires some setup
I have a doubt, for me scene.physics.world.timescale works but, scene.time.timeScale does not seem to work. Should I add some kind of timer to scene explicitly for it to work?
Hi @123survesh,
scene.time.timeScale
only affects to time events.
You can test it setting a new value for scene.time.timeScale
at the end of create() in this example:
http://labs.phaser.io/edit.html?src=src\time\looped%20event.js
Regards.
Hi @jjcapellan,
That makes sense as to why my game did not slow down when I did that.
I am trying to create a slow motion effect, throughout the game. I was able to slow the physics and tweens by adjusting their respective timescales.
scene.physics.timeScale
and scene.tweens.timeScale
But couldn’t slow down the game’s time (say the delta time that is given in the update methods). By any chance, do you know of a way to do that?
You also need to take care of the ParticleEmitters. So, for each scene, you should call:
scene.tweens.timeScale = 0.5;
scene.time.timeScale = 0.5;
scene.physics.world.timeScale = 0.5; // physics
scene.children.list.forEach((child) => {
if (child.type === "ParticleEmitterManager") {
child.timeScale = 0.5;
}
});