swissnetizen Posted March 17, 2015 Share Posted March 17, 2015 I'm using a timer but cannot get it to function. I start it but the time elapsed always stays at 0. The events never fire.My code:game.timer = new Phaser.Timer(game, false)game.timer.add(100, function() { console.log("HIYAD");});game.timer.start();What am I doing wrong? It seems to be all correct.More Info (From probing in the console)game.timer.paused = falsegame.timer.elapsed = 0game.timer.events.length = 0 Link to comment Share on other sites More sharing options...
valueerror Posted March 17, 2015 Share Posted March 17, 2015 game.time.events.add(1000, myfunction); just use this line to create a timer.. should work!game.time.events.loop(100,myfunc); to repeat it every 100ms Pooya72 1 Link to comment Share on other sites More sharing options...
mxmlb Posted March 18, 2015 Share Posted March 18, 2015 If you want a custom timer, i suggest you not to attach it to your game instance.Ex :var timer = game.time.create(false);timer.add(100, yourfunction);timer.start(); swissnetizen and Pooya72 2 Link to comment Share on other sites More sharing options...
Recommended Posts