TheScruffyGuy Posted May 3, 2018 Share Posted May 3, 2018 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'); player.setBounce(0.2); player.setCollideWorldBounds(true); 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) { player.kill(); } and the restart function for the timer event... function restart() { player.revive(); } 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 More sharing options...
rich Posted May 3, 2018 Share Posted May 3, 2018 There's a fair bit of Phaser 2 only code in there (things like 'addKeyCapture', 'kill' and 'revive' are v2 only) - are you definitely using a version of Phaser 2? If not, grab the latest Phaser CE. Link to comment Share on other sites More sharing options...
TheScruffyGuy Posted May 4, 2018 Author Share Posted May 4, 2018 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”? Link to comment Share on other sites More sharing options...
rich Posted May 4, 2018 Share Posted May 4, 2018 Here, like this: http://labs.phaser.io/view.html?src=src\physics\arcade\sprite overlap group.js&v=3.6.0 Click the Edit button to view the source. TheScruffyGuy 1 Link to comment Share on other sites More sharing options...
Recommended Posts