Join Kelley Hecker for an in-depth discussion in this video Store player scores, part of Building a Match 3 Game with Unity.
- [Voiceover] We want to display the highest number of stars…the player has earned on a level in the level select screen.…First, we need to store the player's highest score.…Open the HUD script.…Since we only want to store the score if the player won,…we'll store it in OnGameWin.…StarIdx is the number of stars the player got.…We'll be storing the score in PlayerPrefs.…First we check if the currently stored score…is less than the new score.…For the key, we'll be using the name…of the currently loaded scene.…
I'm going to set the default value to zero.…That means if the player hasn't completed a level yet,…and there's no score stored, this will return zero.…If the new score is greater than the stored score,…then we store the new score.…Now that we're storing the highest score,…we can access it in the level select script.…Go ahead and open that up.…We'll need references to all of the button objects…so that we can show or hide the stars,…depending on the player's score.…
We also need to know what PlayerPref key…is associated with each button.…
Game developer Kelley Hecker covers topics like creating a grid-based game board, using inheritance to create different types of game pieces, adding obstacles and new levels, detecting matches and clearing pieces, and implementing a user interface complete with a score screen. By the end of the course, members will have a completed game and learned new techniques to apply to their next Unity project.
- Creating a game board grid
- Creating and scripting game pieces
- Filling the board
- Creating obstacles
- Swapping pieces
- Matching pieces
- Clearing obstacles and pieces
- Creating new levels
- Creating the user interface: HUD, game over screen, etc.
Skill Level Intermediate
Creating Mobile Games with Unitywith Kelley Hecker1h 12m Intermediate
Build a Real-Time Strategy Game with Unity 5with Dan Violet Sagmiller3h 47m Intermediate
1. The Game Board
2. Make a Move
3. Special Piece Types
4. Level Types
5. User Interface
Next steps1m 29s
- 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.