Pass data to html5 app or call browser?
Monkey Targets Forums/HTML5/Pass data to html5 app or call browser?
| ||
Is it possible to pass some data to the app when starting it (like actual highscore-list) OR request data from inside the app (like a mysql query)? If yes, please give some sample code. I'd like to implement highscore-lists in my online-games. |
| ||
Players on the same computer: "inside the game" is no problem. That means if the highscore datas came from the game, you can save it and recall it with SaveState() and LoadState(). Players on different computers: You can contact any *.php-script on a server, if the mygame.js file and the monkeygame.html file was started from the same url. That's what I do: I use MNET module to do http-get/post with my server. |
| ||
But how to pass the actual data to the game when loading it? Can you give me a simple code-example? |
| ||
from internet or from a file? in another thread I made a sample code: internet: http://www.monkeycoder.co.nz/Community/post.php?topic=4707&post=53622 |
| ||
internet: http://www.monkeycoder.co.nz/Community/editpost.php?post=53622 this post doesn't shop - error. I think the simplest way would be to have the highscore-file (txt) on the server. The game should be able to load it at startup and save it when a new highscore is achieved. |
| ||
A few of ways to do this. Using Mnet : http://www.monkeycoder.co.nz/Community/posts.php?topic=812 Or with a service : Using Scoreoid : http://www.monkeycoder.co.nz/Community/posts.php?topic=3386 Playtomic : https://playtomic.com/api/html5 |
| ||
sorry wrong link this is correct: http://www.monkeycoder.co.nz/Community/post.php?topic=4707&post=53622 "I think the simplest way would be to have the highscore-file (txt) on the server. The game should be able to load it at startup and save it when a new highscore is achieved." That exactly the way I do it. The only problem is you have to care about, that the "monkeygame.html", which contains the "main.js" has to be on the same server. The users have to start it here. |