You need to save the app state between sessions. My tool of choice is a database, but you could also do the same thing by saving the data in a text file.
Big-Picture Steps
- When you start the app, load the saved stickers into a table. Now you can display those at will.
- When an achievement is reached, add the newly chose sticker to that table. Again, you can display them at will and now that new sticker will also be shown.
- When the app ends, save the data in that table to a text file or database.
When you save the sticker data you’re not saving the actual sticker, you’re saving an index into a sticker table. So you’d do something like this:
local allStickers = { "goodjob.png", "greattry.png", "whatakid.png", "waytogo.png" }
Now you can just reference those stickers with a single number, an index into that table. If a kid chose the first and fourth stickers, the data you save would be this:
1,4
Loaded into a table it would be:
local pickedStickers = {1, 4}
When you want to display those stickers on the screen you’d do something like this:
for x=1, #pickedStickers do
local idx = pickedStickers[x]
local sticker = display.newImage( allStickers[idx] )
sticker.x = blah
sticker.y = blah
end
Hopefully that will give you a shove in the right direction. If you need info on saving and loading data, the “Share Your Code” section on this site is a wonderful resource. And one utility that may be just what you need is Ice: http://developer.coronalabs.com/code/ice
Jay
[import]uid: 9440 topic_id: 30509 reply_id: 122246[/import]