Closed shibekin69 closed 4 years ago
Nevermind, I found it:
It'll be something like:
ctimer.tick - ctimer.timer._now = current duration of ctimer in ms
Those are three TimerEvents added to one Timer, so they are all reading the same duration.
I suppose we could add a new method, Timer#getDuration(timerEvent)
.
You could add separate timers instead, e.g.,
var aTimer = this.time.create();
var aEvent = aTimer.loop(/*…*/);
// …
aTimer.duration;
aTimer.ms;
aTimer.seconds;
This Issue is about (pick one, ✏️ delete others)
https://codepen.io/shibekin/pen/wvMywzZ https://phaser.io/examples/v2/time/basic-looped-event (modified code based on this example)
Hi,
I'm not sure if this is a bug really, but I'm trying to get a timer's duration. The example only shows 1 loop timer event being fired, so it's not a problem in that case, but if I'm to use multiple timers, by doing something like:
by doing btimer.timer.duration or ctimer.timer.duration on the console, I'm only getting the value from atimer.timer.duration. If by any chance atimer is destroyed, I will now see btimer.timer.duration's value.
Is there a way to get the duration of a specific timer that's running? We can see that in the example, the second loop is counting accordingly, but I don't know how to get the duration of that timer.
Thanks!