Aleksander87 Posted July 16, 2017 Report Share Posted July 16, 2017 function collectStar (player, star) { // Removes the star from the screen star.kill(); // Add and update the score score += 10; scoreText.text = 'Score: ' + score; if(score === 120) { WHAT TO DO HERE?? show text gameover and retry button (restart game) } } Hello. I'am newbie in Phaser. I just want to upgrade tutorial game with gameover and try again mode. I create if statement when player reach 120 points and next gameover text appear and retry/restart button. Please give me some advice. Quote Link to comment Share on other sites More sharing options...
Kacper Pietrzak Posted July 16, 2017 Report Share Posted July 16, 2017 You can simply create a Phaser.Text object, set its visible property to false and set it to true on game end. There are of course some things to take care of, dependent on your project such as blocking player's input. You can do exactly the same with Phaser.Button that says Try Again. And just in onclick callback of the button reset whole scene. Quote Link to comment Share on other sites More sharing options...
WiLD11 Posted July 16, 2017 Report Share Posted July 16, 2017 this may help you. Quote Link to comment Share on other sites More sharing options...
Gammerr Posted March 19, 2018 Report Share Posted March 19, 2018 Where is the try again button? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.