How to use CCUserDefault to save game data.

Hi

Can anybody pls give me a link to a tutorial or anything which gives me an heads-up start to learn how to use CCUserDefault to save game data.
No idea were to start.i’ve read through “File I/O - How to save/read file on different platforms” section of cocos2d-x wiki page. And i can clearly see how to save/read a file. But i have no idea how can i save game data like stars,high scores,ect using that file.

Thank you

Hi,
You can see UserDefaultTest demo in tests project of cocos2d-x.

@nu1 . I have written a tutorial on how to use CCUserdefault
http://ccuserdefault.blogspot.com/
if above link don’t work…then visit my second blog
http://techbirds.in/how-to-store-a-value-in-a-database-using-ccuserdefault-in-cocos2d-x/
Hope this helps :slight_smile:

So far, so good. :slight_smile:

But how do I make sure, that only higher values are flushed to the xml?:;qst

Greetz
fluse

I’m not sure what you mean…

if  (new value > current value)
{
 defaults->setIntegerForKey("key", new value);
}
else
{
    // this is just for show. do nothing
}