Navigation

    CreatiCode Scratch Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode

    Leaderboard for Games

    2D Blocks
    1
    1
    182
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • info-creaticode
      CreatiCode last edited by admin

      Description

      In many single-player games, the goal is to achieve a high score (such as collecting the most gems) or complete a task in the shortest time (such as jumping through some obstacles).

      For such games, you can show a leaderboard with the top-ranking players and their performances. That’ll make the game more interesting.

       
       

      Record a Player’s Score

      To store the score of a player, you can use the following block in the “Game” extension:

      cc706045-bcc9-44e4-9439-55c49924a2e6-image.png

       
      It takes one input, which is the “score” of the current player. This should be a number value since it will be used to rank between different players. For example, it can be the number of seconds the player used to complete the challenge, or the total number of points or coins the player has gained in the game.

      This value will be stored in the CreatiCode server, so it will be available even if that user closes the browser page or logs off. A user can play the game multiple times, and all the scores will be stored.

       
       

      Show the Leaderboard

      To show the leaderboard among all users who have recorded their scores, you can use the following block:

      6824b8d4-ca22-4c28-9143-62a29324ace5-image.png

       
      This block takes 4 input parameters:

      • Ranking Method: you can specify to show those players with the lowest scores (smallest numbers) or the highest. For example, if the game’s goal is to do something in the shortest amount of time, then you should show the players with the “lowest” scores.
      • Number of Rows: You can decide how many players to list in the leaderboard. If a game has a lot of players, then it makes sense to show a longer list, which will encourage more players to try to compete in the game.
      • Header and Background Color: you can customize the colors of the leaderboard. Note that the text is always in white, and the current user is always in green. Below is an example:

       
       

      Hide the Leaderboard

      To hide the leaderboard, the user can click the “x” button on the top right corner of the leaderboard. However, you can also close the leaderboard use the following block:

      cb82b722-dc20-4674-b808-7533a72b8cb6-image.png

      1 Reply Last reply Reply Quote 0
      • First post
        Last post