Jump to content

Death Counter


Recommended Posts

I am trying my hardest to do this myself and also look for examples but I can not find any. To the point I am trying to build a game where my player health is attached to a timer but the player can collect items to add to the timer with a max limit and if the player runs out of time the player dies and returns to the start point. I am struggling hard on this. This is all I have at this point and not sure any of it is right.

Player Creation in create function

 //Player Creation
            player = this.physics.add.sprite(100, 450, 'robot');

            life = this.time.delayedCall(60000, restart, [], this);
            //Keyboard Register For Life Timer Start
            game.input.keyboard.addKeyCapture([Phaser.Keyboard.LEFT, Phaser.Keyboard.RIGHT, Phaser.Keyboard.UP, Phaser.Keyboard.DOWN]);

Update function for action when timer runs out..

if(life.countLiving() < 1)

and the restart function for the timer event...

function restart()

the restart i know isn't finish yet I have more to put in there

I am building a game that is inspired by a short story I wrote which was inspired by a song.. I am trying to put in the blood, sweat and tears alone but my Javascript knowledge is small and it can get frustrating because I really want to make this game lol

Link to comment
Share on other sites


  • Recently Browsing   0 members

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