JackAttack Posted July 23, 2017 Share Posted July 23, 2017 I'm trying to create a fast-forward mode in a tower defence game. The physics time can be sped up threefold simply using the following: game.time.slowMotion = 1/3; game.time.desiredFps = 20; The problem is the game has many timed events, which use game time, not the physics time that slow-motion affects, set up using code like the following: game.time.events.add( Phaser.Timer.SECOND * seconds, this.spawnAttacker, this, className ).autoDestroy = true Where seconds is some numeric value. So the physics time speeds up 3x just fine, however in the above example, the spawnAttacker function still only occurs every real-time X seconds. I want it to be modified by game.time.slowMotion. I know I could just do Phaser.Timed.SECOND * seconds * game.time.slowMotion; however when fast-forward mode is toggled on/off, all the existing scheduled events will then be incorrect. Does anyone know if it is possible to schedule events like this in the physics time which game.time.slowMotion will affect? Link to comment Share on other sites More sharing options...
samme Posted July 23, 2017 Share Posted July 23, 2017 I think you'll have to modify Phaser.Timer#update. Link to comment Share on other sites More sharing options...
JackAttack Posted July 24, 2017 Author Share Posted July 24, 2017 Thanks Samme, will have a play around there. Link to comment Share on other sites More sharing options...
Recommended Posts