Join Jesse Freeman for an in-depth discussion in this video Restart the game, part of Unity 5: 2D Essential Training (2015).
- So now when the player dies,…we're able to slow down time,…to give us the effect like the game is stopping.…Now, let's look into how to restore time,…and make the game start again.…By selecting our Game Manager,…let's open the Game Manager Script.…At the top of the class, let's go in…and create another private property…called "game started."…This is gonna be a bullion.…And we're gonna use this as a flag to know…when the game is actually started, or when the game is over.…
Now, when we reset the game,…let's set the "game started" flag to "true."…Now, where we call "on player killed," we're gonna set…the "game started" flag, to equal false.…Next, in the update loop,…we're gonna want to test if the game time equals 0,…we know that the game is over.…We can also use the "game started" flag to validate this.…Once we detect that this is over,…we're gonna listen for the "any" key,…and whenever that happens,…we're gonna turn time back to its default value of one,…and we're gonna reset the game.…
So here we're gonna test that "game started"…
Super Zombie Runner riffs off the popular endless runner genre: a one-button casual game that's not only fun to play but exciting to build. The focus of the work is a reusable code base that you can extend and make your own, while learning the basics of object pooling, supporting multiple screen resolutions, tracking scoring, and multi-platform publishing. Along the way, Jesse covers key Unity features, such as working with sprites, creating animations, and leveraging the UI components.
- Working with sprites and animation
- Creating the player
- Spawning GameObjects
- Adding obstacles and collisions
- Building the game objects and logic
- Managing game state
- Creating pixel-perfect cameras
- Designing for multiple screen resolutions
- Adding scores
- Optimizing performance
- Publishing to desktop, web, and mobile platforms
Skill Level Intermediate
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Adding UI
8. Creating More Obstacles
- 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.