How to Create an Accurate Timer for Phaser Games.

Article by Richard Davey. Posted on 24th Mar 2016.   @phaser_

image

From Josh Morony: "In a few of my projects I’ve been using a pretty simple timer, the general idea was I’d start off with some variable to hold the total time of the game and then create a timer loop to decrement that value.

I would visually represent that somewhere on the screen (usually a bar that gradually decreased in width) and detect when the value reached 0 to trigger a game over.

I implemented this same timer in the latest game I’ve been working on (a word game which I will hopefully be releasing soon!) and it seemed to work really well. That was until my partner suggested that maybe the game took a little too long… seemed about right to me, 2 minutes isn’t that long? But she was racking up pretty massive scores, something was definitely fishy."

Read More