Jump to content

Physics time and game.time.events.add


Recommended Posts

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:

	Phaser.Timer.SECOND * seconds,
).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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...