Search the Community

Showing results for tags 'game over'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hi Community, I want to make an Game Over screen for my Top Down Test Game. My Code is in states. I did load the state with "game.state.add('gameover'), gameoverState);" on my play.js gameover: function () { if (sprite.body.y > 700) { game.state.start('gameover'); } gameover.js var gameoverState = { create: function () { var gameoverLabel = stateText = game.add.text(game.world.centerX, game.world.centerY, ' ', {font: '84px Arial', fill: '#F2F2F2'}); stateText.anchor.setTo(1.1, 0.2); }, update: function () { game.world.removeAll(); stateText.text = " GAME OVER \n Click to restart"; stateText.visible = true; //the "click to restart" handler game.input.onTap.addOnce(function () { game.state.restart();}, this.start); }, start: function () { game.state.start('menu'); } }; Everytime I die this will pop up, no text just all the obj and layer resize in 16x16 or 32x32. Regards, ITpaolo btw. Sorry, i'm nooby in Phaser. :-P EDIT: I know now that this was the problem for it: play.js /* if (sprite.body.x < -30) { sprite.body.x = this.game._width - 30; } if (sprite.body.x > 650) { sprite.body.x = this.game._width - 650; } if (sprite.body.y < -50) { sprite.body.y = this.game._height - 50; } if (sprite.body.y > 660) { sprite.body.y = this.game._height - 650; } */ But now Idk how to do the Game Over screen, any help? EDIT2: Did now: play.js if (sprite.body.y > 650) { stateText.text = " GAME OVER \n Click to restart"; stateText.visible = true; //the "click to restart" handler game.input.onTap.addOnce(function () { game.state.restart(this.start);}); } }, start: function () { game.state.start('menu'); } Its now restarting the 'play.js', if I click "restart" but I want that he start the "menu.js" state, any help 2.0? ^^ EDIT3: I fixed it, hope I can help anyone. play.js if (sprite.body.y > 650) { stateText.text = " GAME OVER \n Click to restart"; stateText.visible = true; //the "click to restart" handler game.input.onTap.addOnce(function () { game.state.start('menu');}); } }, start: function () { game.state.start('menu'); } EDIT4: The last edit, now I fixed it really, he now start the 'gameover.js' when the sprite die.^^ play.js if (sprite.body.y > 650) { game.state.start('gameover'); } gameover.js var gameoverState = { create: function () { var gameoverLabel = stateText = game.add.text(500, 300, ' ', {font: '50px Arial', fill: '#F2F2F2'}); stateText.anchor.setTo(1.1, 0.2); }, update: function () { if (sprite.body.y > 650) { stateText.text = " GAME OVER \n Click to restart"; stateText.visible = true; //the "click to restart" handler game.input.onTap.addOnce(function () { game.state.start('menu');}); } } };