How to use FlxSave to save int? #2474
-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
to access a function getSavedLevel():Int
{
// check null in case no level was saved yet
if (FlxG.save.data.level != null)
return FlxG.save.data.level;
return 1;
} and to save the level: function saveLevel(level:Int)
{
FlxG.save.data.level = level;
// flush() actually saves whatever data you've set to local storage
FlxG.save.flush();
} Note that |
Beta Was this translation helpful? Give feedback.
-
ok so TURNS OUT now i'll try to add saving/loading things |
Beta Was this translation helpful? Give feedback.
ok so TURNS OUT
the game crashed bc i havent identified 'finish' as FlxSprite:
finish = new FlxSprite(0,0)
now i'll try to add saving/loading things
edit: it launches ok