ForgeableSum Posted February 2, 2017 Share Posted February 2, 2017 Suppose I create an event using game.time.event.add. That Phaser.TimerEvent is stored in game.time.event.event, great. But how do I calculate how long it will take for that event to fire based on the current game time? I'm sure it has something to do with tick: https://phaser.io/docs/2.6.2/Phaser.TimerEvent.html#tick But what exactly is tick anyway? The docs say "the next game clock time that this event will fire at," but looking in the value stored in there, it is a huge value. Like: 20983490329048 compared to the game clock (game.time.now) which, at the same time is something like: 17002 Are the docs referencing some other clock, and not game.time.now? Link to comment Share on other sites More sharing options...
samme Posted February 2, 2017 Share Posted February 2, 2017 Phaser.TimerEvent.html#tick refers to Phaser.Time.html#time, so it's a near-future date (measured in ms). It's odd but Timer doesn't tell you the event interval, you have to calculate timerEvent.tick - timer._now ForgeableSum 1 Link to comment Share on other sites More sharing options...
ForgeableSum Posted February 2, 2017 Author Share Posted February 2, 2017 2 hours ago, samme said: Phaser.TimerEvent.html#tick refers to Phaser.Time.html#time, so it's a near-future date (measured in ms). It's odd but Timer doesn't tell you the event interval, you have to calculate timerEvent.tick - timer._now ah, so it's a date. i suppose that's what the docs meant by real world time. Link to comment Share on other sites More sharing options...
rroylance Posted February 2, 2017 Share Posted February 2, 2017 There is also game.time.events.duration (https://phaser.io/docs/2.6.2/Phaser.Timer.html#duration), if the event you want to know is the next in line this property will tell you in milliseconds how long until that event fires (https://phaser.io/examples/v2/time/basic-timed-event). Link to comment Share on other sites More sharing options...
Recommended Posts