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

Share this post

Link to post
Share on other sites

Hello Rich,

I have the V3 js in my js folder.. I like I said I have been looking for examples I may have used the wrong versions in some spots.. I couldn’t find any v3 except for the timer, so I tried to “make it work”?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.