Do you want to add a way to keep score in your game? Or maybe you want to show who completes your game the fastest? These are possible by adding a leaderboard. There are two types of leaderboard you can add: Score-based, or Timer-based.
The easiest way to do this is by using our premade leaderboard, as they already contain all the logic necessary to set up a leaderboard.
We also recommend checking out our in-app tutorial Add a Leaderboard and following the steps there.
https://wiki.hypehype.com/how_to/leaderboardintro.mp4
- Look for the premades in the Logic section of the Asset library by searching for “Leaderboard.”
- Add the one you would like to use. Either Leaderboard: Time or Scoreboard.
- If you are using Scoreboard, we recommend also adding some premade Collectables, like the gems or coins.
- Search for “Collectable” on the Premades section of the Asset library.
Now, all you need to do is set up the leaderboard in the Save menu:
- Go save your draft by tapping the Save button on the top right.
- Give it a name and description, and select a category.
- Next to Leaderboard, select either the Time or Number option, depending on the leaderboard you are using.
- Next to Sort Order, select either the Highest number (3, 2, 1) or Lowest Number (1, 2, 3) option, depending on the kind of scoring you want.
- Now publish your game. You can do it as unlisted if you don't want it to appear in your profile.
- Add a runner player and a collectible item from the Premade section in the asset library. For this, add the Platformer Player and the Collectable Gem.
- Add more instances of the Gem.
- Add the following nodes.
- Broadcast listener
- Text
- Compare
- Score
- Game End
- Open the Broadcast Listener and set Listen to - Get Score.
- Drag a link from Broadcast Listener - On Signal Received to Compare - Value A.
- Convert the link type, and change Set to Add.
- Drag a link from Broadcast Listener - On Signal Received to Text - Value.
- Convert the link type, and change Set to Add.
- Drag a link from Broadcast Listener - On Signal Received to Score - Score.
- Convert the link type, and change Set to Add.
- Make sure it is not executing.
- Now, open the Compare node, and change Value B to however many gems you added.
- Operator should be Equal.
- Drag a link from Compare - Output if True to Game End - Execute.
- Drag a link from Game End - On Game End to Score - Execute.
What you have now is a functioning Score-based leaderboard. When the player collects all the gems, the Game End will execute, which will at the same time execute the Score node.
To finish up, set up the leaderboard like we did for the premades:
- Go save your draft by tapping the Save button on the top right.
- Give it a name and description, and select a category.
- Next to Leaderboard, select the Number option.
- Next to Sort Order, select the Highest number (3, 2, 1) option.
- Now publish your game. You can do it as unlisted if you don't want it to appear in your profile.
- Add a runner player from the Premade section in the asset library, and a Circle Marquee.
- Place the marquee some steps away from the player character.
- Add a collision trigger node to the Marquee. Make sure it triggers with the green group.
- Now add the following logic:
- Timer
- Text
- Score
- Game End
- Drag a link from Timer - Output to Score - Score.
- Drag another link from Timer - Output to Text - Value.
- Open the Text node, and make Type - Time. Make sure the Decimals are 0.00.
- Now, drag a link from Game End - On Game End to Score - Execute.
- Finally, drag a link from the Marquee's Collision Trigger - On Collision Start to Game End - Execute.
What you have now is a functioning Timer-based leaderboard. When the player collides with the Marquee, this will trigger the Game End, which executes the Score node.
To finish up, set up the leaderboard like we did for the premades:
- Go save your draft by tapping the Save button on the top right.
- Give it a name and description, and select a category.
- Next to Leaderboard, select the Time option.
- Next to Sort Order, select the Lowest number (1, 2, 3) option.
- Now publish your game. You can do it as unlisted if you don't want it to appear in your profile.
Now the Leaderboard score will be saved once the game is completed (when the player touches the Marquee).
- You can end the game in whichever way you want! You can have a score-based leaderboard execute when the player reaches a certain point, independently of whether they collected all the items or not.
- Leaderboards can't be playtested. You will need to publish to make sure that it works appropriately.
- Using the premades is recommended at the beginning. You can use them as a first step to study logic.
Pro Creator Tip: You can group logic by using containers. This will help keep your logic organized.
Explore the following links for more related content and additional resources. These pages contain valuable information that complements what you’ve just read.
Connecting Nodes