Merge pull request #6375 from samme/feature/clock-startTime

Add Phaser.Time.Clock#startTime
This commit is contained in:
Richard Davey 2023-01-30 15:33:29 +00:00 committed by GitHub
commit 4d4aa77a68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -56,6 +56,17 @@ var Clock = new Class({
*/
this.now = 0;
/**
* The time the Clock (and Scene) started, in milliseconds.
*
* This can be compared to the `time` parameter passed to a Scene's `update` method.
*
* @name Phaser.Time.Clock#startTime
* @type {number}
* @since 3.60.0
*/
this.startTime = 0;
/**
* The scale of the Clock's time delta.
*
@ -144,6 +155,8 @@ var Clock = new Class({
*/
start: function ()
{
this.startTime = this.systems.game.loop.time;
var eventEmitter = this.systems.events;
eventEmitter.on(SceneEvents.PRE_UPDATE, this.preUpdate, this);