How to implement a highscore list?
Monkey Targets Forums/iOS/How to implement a highscore list?
| ||
Yeah, basically what the title says. I have no idea how to implement a highscore list. Any hints? |
| ||
I work on the basics for that (check out MNet in the projects section). The easiest way would be to do it with php on server side and simple http requests on client side. Will post an example if I find some time... |
| ||
i guess at the moment on targeting ios the easiest thing to do is to download imonk it provides some nice functions for that purpose: GetUID$() SaveAppPreferences(key$,value$) LoadAppPreferences$(key$) HTMLPost(URL$="http://music.xzess.org", Parameters$="foo=bar&key=value") Then you could do it like this: Import imonk Local deviceid:String = GetUID() Local highscore:Int = 1500 'in example Local name:String = GetITunesName() Function SaveScore() SaveAppPreferences("DeviceID",deviceid) SaveAppPreferences("Highscore",highscore) HTMLPost("http://www.myserver.com/index.php","action=save&uid=" + deviceid + "&score=" + highscore + "&name=" + name) End To get the highscore you can use HTMLQuery( URL$ ) Function GetHighscore:String() Local query:String query = HTMLQuery("http://www.myserver.com/index.php?action=getscore") Return query End Function ShowScore() 'Better to do this onCreate() atm because there is no DidFinishLoading() currently 'Otherwise the String will be empty Local query:String = GetHighscore() UIAlert("The Highscore: ", query,"Back to Menu") End Function SendScoreWithMail() Local device = GetDeviceType() UIEMail("","My Highscore in MyGame","Hey, can make a better score as " + highscore + " ? ~n" + "~n" + "Sent via MyGame from my " + device) End Just as example. Greetz |