ATTENTION: Scoreboard API
You can use this to create and persist a scoreboard for your game.
It's very simple:
-
include a script in your app
<script src="https://scoreboard--amasad.repl.co/scoreboard.js"></script>
-
You'll get a global object
scoreboard
-
scoreboard.submit\({username: 'playerNameHere', score: numberScoreHere}\)
-
List the scoreboard using
scoreboard.list\(\).then\(topTenScores => console.log\(topTenScores\)\)
The script is smart enough to create a board for your game (it's domain-based) so it's very easy to use. End to end example here: https://repl.it/@amasad/scoreboard-example
Here is the source code for the service if anyone is interested https://repl.it/@amasad/scoreboard 😉
You missed a ) at the end of the fourth point
@iamcaleblol: fixed! Thanks
i think is awesome the api was made with GO lang :)
@user23802991: awesome :)
@iamcaleblol: Really securing a leaderboard is pretty hard, if you have both front and back totally open source (inclusive the secrets)
@iamcaleblol: lol yes, not sure how we can secure it though. You can do that with Firebase or any other clientside data API. Open to ideas.
If a player wants to submit his score multiple times, how can I make it so it can delete his previous scores?
@iamcaleblol: I made it so that it picks the highest score.
E.g.
- amasad scored 10
- amasad scored 8 (it's still 10 because it's higher)
- amasad scored 12 (it will register 12 because it's the highest)
Does it make sense?
@user23802991: OK Thanks
@iamcaleblol: Let me know if you want to reset the data or delete something and I'll do it for you
wow great assistant to games
HTML5 <crying emoji>
Does this work in just a normal HTML file that you open on your computer?
someone has hacked repl and is spam tagging users, I am VERY pissed off right now as every time i am pinged it sends me an email, i have been pinged over 2000 times in the past 4 hours. If you do not fix this i swear to god i will quit repl
@BobTheTomatoPie we have a fix on the way, sorry about that.
im have never been more happy from a ping, thank you so much man @amasad