Make a highscore visible to all players of a game?
I have an infinite runner game I coded that my classmates compete for high scores on, is there a way I could make high scores visible to all? basically make select variables universal across all users and update their values on page load
You’ll need a database of some sort. I would recommend using another repl and setting up a endpoint to get and save the score or you could use Firebase Firestore by Google and not worry about the backend stuff. I’ve used both so reply if you need any help
@BrysonVan1 I don't know a LOT of these keywords, so what this does step by step would be great. I know NOTHING besides variables, functions, object literals, DOM, arrays, etc, nothing about getting other files or databases, get, send, set, query, about 95% of code used in this, it might as well be a new language, could you send me the MDN documentation for the methods this uses?
@EthanBlesch So, the confusing thing about Node.JS is that’s it’s totally separate from Client side JS. The code I put together creates a route for your code to reference, so whenever you need the high score, use fetch() (look it up on mdn) to get the score and show it using html Canvas text.To merge the two projects, put your files all in the public folder in the repl I made. ( you will need to change your link and script tags with a / before the file path) For instance: “script.js” -> “/script.js” (do the same for CSS)