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. 知识库
  3. 二维积木
  4. 游戏排行榜

游戏排行榜

Scheduled Pinned Locked Moved 二维积木
1 Posts 1 Posters 809 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

    介绍

    在很多单人游戏中,游戏目标是获得最高的分数(比如收集最多的宝石)或者在最短的时间内完成任务(比如跳过所有障碍物)。

    对于此类游戏,你可以显示一个排名榜,也就是玩儿的最棒的用户的列表。这将使游戏更有趣。

     
     

    记录玩家分数

    要存储玩家的分数,你可以使用“游戏”扩展中的这个积木:

    ac7203f2-d603-4188-adff-7ea440441c2a-image.png

     
    它只需要一个输入,即当前玩家的“分数”。这应该是一个数字,因为它将用来给玩家排名。例如,它可以是玩家完成挑战所用的秒数,或者玩家在游戏中获得的积分或硬币总数。

    这个数值将存储在创益编程的服务器上,所以即使该用户关闭浏览器页面或注销,这个分数也还是会被保留。一个用户可以多次尝试这个游戏,而每次的分数都会被记录。

     
     

    显示排行榜

    要显示所有玩家的排行榜,你可以使用下面这个积木:

    51e6a5c5-9fd6-414e-94ab-f193dafcf4dc-image.png

     
    这个积木有 4 个输入参数:

    • 排名方式:您可以指定显示那些分数最低(最小数字)或者最高的玩家。举个例子,如果游戏的目标是在最短的时间内完成某个任务,那么你应该把玩家按照分数从低到高进行排名。
    • 行数:你可以决定在排行榜中列出多少个玩家。如果一个游戏有很多人玩儿,那最好显示一个更长的列表,这将鼓励更多的玩家尝试“冲榜”。
    • 标题和背景颜色:你可以自定义排行榜的背景颜色。请注意,文字始终为白色,而当前用户的信息始终为绿色。以下是一个示例:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/567ad822-feaa-4ca7-8782-b58a66cbdc6c.png" width="500" style="margin-left: 40px; border-radius: 5px; border: 1px solid #29622d;">

     
     

    隐藏排行榜

    要隐藏排行榜,用户可以单击排行榜窗口右上角的“x”按钮。但是,你也可以使用以下积木自动关闭排行榜:

    9bdf9036-3b38-4a5a-9a4f-fe452cbd62d2-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