Join Joseph Labrecque for an in-depth discussion in this video Adding "Game Over" text, part of HTML5 Game Development with Phaser.
…We'll now create a game timer to keep track of how many…seconds the bunnies survive.…And some game over text, which will display the final seconds elapsed.…This provides an incentive for…the player to get a better score on subsequent play throughs.…We also must allow the player to restart and play again, once the game is over.…To do this we'll add a couple of new variables to our game.…So right up top here this.overmessage, and that's going to…be our bit map text over message, and we'll say this.secondselapsed.…
And that's going to be a counter, where we'll increment the seconds.…Keep track of that.…And, the last thing is a timer.…So, phaser has timer functionality.…We can create timers and have things execute on every loop and so forth.…So we'll use a timer to keep time of the seconds elapsed from when the game starts.…Next, we'll go down into our create function.…And here we're going to set secondsElapsed to 0.…So this.secondsElapsed=0.…
We'll also create our timer here.…So this.timer, and we'll set that equal to this.time.create.…
- Downloading the Phaser framework
- Creating your first Phaser project
- Building the preloader and menu states
- Creating and spawning entities
- Working with particles and emitters
- Detecting and handling collisions
- Detecting "game over"
- Adding sound effects and text
- Preparing for mobile deployment
Skill Level Beginner
1. Setting Up Phaser
2. Configuring Loaders and States
3. Populating the World
5. Wrapping Things Up
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.