Jump to content

How to make custom Timer?


spinnerbox
 Share

Recommended Posts

I want custom timer. I make a memory game i.e I have to choose from a set of cards and find all the pairs. So if I pick two non-equal cards my timer should run their closing animation.

 

I did this:

cardTimer = new Phaser.Timer(gameObject, false);

cardClosingEvent = function () { 

 

     // doo some stuff

     cardTimer.stop(false);

}

 

cardTimer.add(1000, cardClosingEvent);

 

openCards =function () {

    // do some stuff

    cardTimer.start();

}

 

if I log the timer object in console, the events subarray is empty. Not sure what it goes wrong. It is like the TimerEvent is removed from the timer after the timer runs once.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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