Join Jesse Freeman for an in-depth discussion in this video Connecting the score to the game manager, part of Unity 5 2D Essential Training (2015).
- So now that we have a text field to represent our score,…let's connect this up to our game.…In the GameManager, let's open up the GameManager code.…From here, we're going to need a public property…that'll represent the instance of the scoreText.…Next, we're going to need two private properties…that'll represent the timeElapsed,…and the bestTime.…Now, we want to make sure that we reset the timeElapsed…every time we restart the game,…so here in our ResetGame method,…let's set the timeElapsed = 0.…
Next, we're going to want a way to format the timeElapsed…when we put it back into the text field.…To do this, let's create a new method…that'll return a string, and we're going…to call this FormatTime.…And in this, we're going to pass in a float…that'll be the value of time in milliseconds.…And to just get us started, let's have it return the value,…and we'll call ToString to convert it into a string.…Now the first thing we want to do…is display the time and the best time,…when the game is not running.…
So here, inside of our update loop,…
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?
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.