In this video, Jesse Freeman teaches you how to end your endless runner game. When the player dies by getting pushed off the screen, you'll need a way to stop the game and then let the player quickly restart when they are ready to go again. Learning how build a game loop in Unity 5 is an import skills for building a 2D game.
- [Voiceover] Now it's time for us to connect up the logic…that'll let us know when the game is over.…We're gonna be using when the player dies…as this trigger event.…Now, in order to do this,…we're gonna need a way for the game to be able to tell…when the player has actually died.…One way is to use a delegate.…To illustrate how this works,…let's open up the DestroyOffscreen script.…At the top of our script,…let's add two new public properties.…
The first is gonna be a public delegate…with a return type of void called OnDestroy.…Next is going to be the actual event that we'll map this to…called public event.…We'll type it to our OnDestroy method above…and we'll call this DestroyCallback.…One of the easiest ways to think of what a delegate is…is by connecting one property to another method…so that when we call the property,…we'll, in essence, be calling another method.…
It will allow us to make connections…from one script to another.…Now, just hearing that doesn't make it very easy to grasp,…so let's take a look at how we can actually use this.…
Start watching to learn how to convert artwork into sprites, create repeating background textures with Unity's TexturePacker, and build reusable game objects such as players, obstacles, and enemies. Jesse also covers the basics of object pooling, working with custom UI components, and multiplatform publishing.
- Importing artwork
- Editing sprites
- Creating repeating background textures
- Building reusable obstacles
- Recycling game objects
- Building an object pool
- Creating the player
- Starting and ending the game
- Displaying and saving the score
- Adding menus and text
- Publishing a Unity game in different formats
Skill Level Beginner
1. Working with Sprites
2. Creating Repeating Textures
3. Creating Obstacles
4. Object Pooling
5. Creating the Player
6. Setting Up the Game
7. Polishing the Game
8. Creating More Obstacles
Publish to different formats5m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.