scunliffe Posted March 22, 2016 Share Posted March 22, 2016 In the puzzle game I'm working on I'd like to maintain an elapsed time clock shown to the user indicating how long they have been working on a particular puzzle. e.g. 00:13:45 (thirteen minutes and fourty-five seconds) I have no issues with the math to display the time, nor the APIs to render the text... my question is how to do this effectively? e.g. I currently wired this up to run in my main update() loop however this therefore tries to run as frequently as it can but I only need it to run once per 1,000ms or in 1 frame (if running at 60fps) Is there an API to only call something a "max" of once per "time period"? Link to comment Share on other sites More sharing options...
Shantred Posted March 22, 2016 Share Posted March 22, 2016 Is there any reason you couldn't just create a timer? You can loop it every 1000ms to update the time instead of directly putting it in the update loop. Link to comment Share on other sites More sharing options...
scunliffe Posted March 22, 2016 Author Share Posted March 22, 2016 I can.. in fact that was what I was going to resort to if I didn't find anything more applicable ;-) I'm fairly new to Phaser so I was just trying to see if there was a "better" or built in way so that I'm not reinventing the wheel. Link to comment Share on other sites More sharing options...
Recommended Posts