roninkode Posted August 16, 2018 Share Posted August 16, 2018 What is the simplest way to display "GAME OVER" once your game ends? I have this line of code: let gameOverText = this.add.text(320, 240, 'GAME OVER', { fontSize: '32px', fill: '#fff' }); but I don't know where to put it for it to work. Right now, I just have the message logging to the console and it works fine. I think its the "this" that's messing me up. Any ideas? Link to comment Share on other sites More sharing options...
gafami Posted August 16, 2018 Share Posted August 16, 2018 Hope this help you // Display word "Game Over" at center of the screen game let gameOverText = this.add.text(game.config.width / 2, game.config.height / 2, 'GAME OVER', { fontSize: '32px', fill: '#fff' }); // Set z-index just in case your text show behind the background. gameOverText.setDepth(1); samme 1 Link to comment Share on other sites More sharing options...
pingu Posted August 17, 2018 Share Posted August 17, 2018 On 8/16/2018 at 6:24 AM, roninkode said: but I don't know where to put it for it to work. Right now, I just have the message logging to the console and it works fine. I think its the "this" that's messing me up. Any ideas? Have you done the Phaser 3 tutorial on the official website? Without doing it and not having JS fundamentals, you probably can't get far. Link to comment Share on other sites More sharing options...
Recommended Posts