Phaser Card Timer

This is a card timer based on a question asked on the Facebook Phaser Game Makers group. It will work with any square image and place a line around the box, card or image. The line moves around the card until the time is up.


//add an image
this.card = this.add.image(game.config.width / 2, game.config.height / 2, "card");
//make a cardTimer and pass in the image       
        this.cardTimer = new CardTimer({
            scene: this,
            obj: this.card

Set a callback

this.cardTimer.setCallback(this.timeUp, this);

Start the timer


Stop the timer


Reset the timer