Jump to content

Phaser Score


craidencool
 Share

Recommended Posts

I'd recommend learning at least the basics of a server-side language like PHP, Ruby or Node.js as there probably won't be a quick copy/paste "it just works" solution.

You'll need a server and a database set up (you can set it up locally for testing with something like XAMPP).

Essentially, on the client side, when the player gets a new high score, you probably want to send that data (in your case, score and probably a username) to an endpoint through an AJAX POST request.

On the server, you would need some code that would grab that data and add it to a database. (http://www.w3schools.com/php/php_mysql_insert.asp)

To display it as a high score table, you'd need a second endpoint, where you'd perform an AJAX GET request. 

On the server, you would need some code that would return all the items stored in your database in JSON format. (http://www.w3schools.com/php/php_mysql_select.asp)

Once this is returned, you then display this data on screen via JavaScript.

This is a simplified explanation. If it sounds complicated, just read up a little on server-side web programming in whatever language you prefer (I gave PHP in the examples as it's probably the easiest to play with locally with XAMPP).

Link to comment
Share on other sites

1 hour ago, gnoof said:

I'd recommend learning at least the basics of a server-side language like PHP, Ruby or Node.js as there probably won't be a quick copy/paste "it just works" solution.

You'll need a server and a database set up (you can set it up locally for testing with something like XAMPP).

Essentially, on the client side, when the player gets a new high score, you probably want to send that data (in your case, score and probably a username) to an endpoint through an AJAX POST request.

On the server, you would need some code that would grab that data and add it to a database. (http://www.w3schools.com/php/php_mysql_insert.asp)

To display it as a high score table, you'd need a second endpoint, where you'd perform an AJAX GET request. 

On the server, you would need some code that would return all the items stored in your database in JSON format. (http://www.w3schools.com/php/php_mysql_select.asp)

Once this is returned, you then display this data on screen via JavaScript.

This is a simplified explanation. If it sounds complicated, just read up a little on server-side web programming in whatever language you prefer (I gave PHP in the examples as it's probably the easiest to play with locally with XAMPP).

do you have sample codes on how to implement this sir? thank you!

Link to comment
Share on other sites

  • 2 years later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...