Sign in to follow this  
binarez

Is game.time.elapsed always guaranteed to be in milliseconds?

Recommended Posts

Hi,

 

I'm using game.time.elapsed to update my game entities. They are expecting frame delta time in milliseconds (ms). It seems to work. On all platforms, will elapsed be in milliseconds? Am I using game.time.elapsed correctly?

 

Thanks for the awesome engine.

Share this post


Link to post
Share on other sites

Ok, I guess no one else is using game.time.elapsed?

 

What are you using to get time per frame? I'm looking to get a value in milliseconds (number) so I can pass that to update my entities. Thanks for any info!

Share this post


Link to post
Share on other sites

I went and did some digging : http://gametest.mobi/phaser/docs/Time.js.html#sunlight-1-line-107

 

So elapsed seems to be the difference between last frame's milliseconds timestamp vs this frame's... exactly what I need.

 

Extra references:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now

https://developer.mozilla.org/en-US/docs/Web/API/Performance.now%28%29

Share this post


Link to post
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.

Guest
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.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.