Simple High Score
The Simple High Score Template provides you with the building blocks for building a simple score-tracker in a game. By extensions, this template is an example of how to create Lenses that read and write persistent storage.
The Simple High Score Template features a pair of buttons used to increment and store a score, which is displayed as a score at the top of the screen. When the user leaves and returns to the Lens, they'll see that their "High Score" field has been saved from the last time they opened the Lens. For a more involved example of persistent storage, please refer to the High Score template.
When you open the project, you'll see two buttons at the bottom of the
- A button labeled Add Point
- A button labeled End Game
At the top of the screen is a display that contains:
- The user's Snapchat display name, which makes use of Lens Studio's dynamic text system
- A number labeled "Current Score"
- A number labeled "High Score"
When the user presses the Add Point button, the Current Score value will increment by 1.
When the user presses the End Game button, the High Score value is set to the Current Score, and the Current Score value is set to 0.
Additionally, pressing the End Game button writes the new High Score value to persistent storage. When the user closes and reopens the Lens, the High Score value is recovered and displayed again.
To learn more about reading and writing data in Lenses, please visit the Persistent Storage guide
Submitting Your Lens
You’re now ready to submit your Lens! Follow the below guides:
Still Looking for help?Visit Support