Does anyone know how to implement a saved local high score in Run Rabbit Run?
http://developer.anscamobile.com/code/run-rabbit-run
[import]uid: 125387 topic_id: 23159 reply_id: 323159[/import]
Does anyone know how to implement a saved local high score in Run Rabbit Run?
http://developer.anscamobile.com/code/run-rabbit-run
[import]uid: 125387 topic_id: 23159 reply_id: 323159[/import]
I haven’t used this code but it would be no different to any other high score system I don’t imagine.
Is there a gameover function? If so you would save the score there. [import]uid: 52491 topic_id: 23159 reply_id: 92708[/import]
Thanks for your reply. Yeah, I’ve tried a few variations but it’s getting messed up (the project uses director). I haven’t found a good resource on getting the highscores working with director. [import]uid: 125387 topic_id: 23159 reply_id: 92776[/import]
The biggest thing with director is passing data between modules, which isn’t hard and there are several approaches.
The easiest one is to use the _G super-global table. Simply add your score to that table:
\_G.highscore = highscore
Then you would have a director style highscore.lua file and when you do a director.changeScene(“highscore”) simply display the high score as you like inside of highscore.lua with something like:
local highScoreValue = display.newText(string.format("%06d",\_G.highscore), display.contentWidth / 2,display.contentHeight / 2, "Helvetica", 32))
[import]uid: 19626 topic_id: 23159 reply_id: 92790[/import]
Thanks for your reply. I’m going to give this a shot
[import]uid: 125387 topic_id: 23159 reply_id: 92918[/import]
That should solve your problem but I also have this tutorial that may interest you: http://techority.com/2012/01/13/easy-saving-of-highscore-in-corona-sdk-apps/
It uses Ego to save the score so you could easily use it with Director as well, just load it on final scene.
Peach
[import]uid: 52491 topic_id: 23159 reply_id: 92939[/import]