Jump to content

Timer doesn't Start()


jotaSe
 Share

Recommended Posts

Hi, I tested phaser 1.1.3 and I used Timer this way:

        Timer = new Phaser.Timer(game);        Timer.onEvent.add(spawnBonus);        Timer.add(1);        Timer.start(); function stuff(){    Timer.stop();     //stuff...     Timer.start();     Timer.add(delay);  }

Now, using 1.1.5 there's not Timer.onEvent.add, so I change it for this

        Timer = new Phaser.Timer(game,false);        Timer.add(1, spawnBonus, this);        Timer.start();

But this Timer never start, I have to create a time.event.loop to handle it, but, it's not enough cuz I need to set the delay with a random number. Any help?

Link to comment
Share on other sites

 Any clues why the following code never calls the event callback?

var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });var testTimer;function preload(){}function create(){	testTimer = new Phaser.Timer(game, false);	testTimer.add(250, function(){ console.log('Event callback.'); }, this);	testTimer.start();}function update(){}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...