Game Development Community

Save and Retrieve a Score at iPad

by Claudio Torres · in iTorque 2D · 06/16/2011 (5:59 pm) · 3 replies

My first iTorque 1.4.1 Game is ready for publishing, BUT I would like to implement a Best Score functionality since version 1.

I need a short code to Save my $bestScore variable at the end of each level, and restore it at the start of the game. This will allow the player to remember its best score even when finish the game to play latter.

Can anyone help me with a short code to save and restore a iTorque global variable $bestScore at iPad?

Thanks

About the author

Electronic Engineer, MSc on System, Software Developer, Digital Marketing Consultant. Today I managing Torres Studios, a new Game and Entertainment Studio focus on create innovative iPad and XBOX 360 Games.


#1
06/16/2011 (11:57 pm)
You can use the following to save a value:
iPhoneSaveStringToDevice(%placeName, %value);

and the following to load it:
iPhoneLoadStringFromDevice(%placeName);

So in your case it would be something like this:
saving:
iPhoneSaveStringToDevice("score", $bestScore);
loading:
$bestScore = iPhoneLoadStringFromDevice("score");
#2
06/17/2011 (2:46 am)
Where can I find this function definition? iPhoneSaveStringToDevice and iPhoneLoadStringFromDevice
#3
06/17/2011 (3:55 am)
in iPhoneFileIO.mm