Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. Leaderboard for Games

Leaderboard for Games

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 969 Views
  • 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.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    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
    0

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode