We need a way to save high scores between sessions.
- [Daniel] Hello, and welcome to video 4.4.…In this video, we're gonna talk about the WebStorage…and how to save game data into the WebStorage.…In the previous video,…we've talked about adding touch events to the game.…Now we're gonna focus more on the data side of the game…and how to handle it.…One of the elements to make a game more competitive…is to add a high score.…You'll be able to see if you improve through time…by seeing every time you play the high score you received.…
Now, if we use a standard variable…every time we refresh the game,…the variable will reset.…So in this case, we'll use the WebStorage.…WebStorage consists of local storage and session storage.…Session storage is relevant only for this current session.…Meaning that if we refresh the game,…the variables will reset,…so it's of no use to us.…So we'll use the local storage…to save data in between sessions.…So even though the user refreshes the browser,…the data will still be there.…
So we're gonna add the highScore variable,…which we'll use to hold the value…
Note: This course was created by Packt Publishing. We are pleased to host this training in our library.
- Playing sounds in various browsers using SoundJS
- Tweening objects using TweenJS
- Creating graphic assets and basic animations
- Game stage creation and object positioning
- Adding the basic game logic
- Add the game physics
- Adding mouse and keyboard controls
- Debugging with breakpoints in Chrome
- Debugging on Android and iOS
- Character movement and input handling
Skill Level Advanced
iOS Game Development with Swift 3 and SpriteKitwith Todd Perkins2h 52m Intermediate
2. Game Outline
3. Game Logic
4. Planning Your Second Game
5. Testing and Debugging the Game
6. Character Movement and Input Handling
- 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.