Good day, for a while I'm trying to save my table in Corona SDK. The unlocked levels still have to be unlocked when exiting and entering the game.
I've tried several things, but I still can't figure it out. How can I accomplish this?
Here is part of my code:
G = {
Gamescore1=0,
Gamescore2=0,
Gamescore3=0,
Gamescore4=0,
Gamescore5=0,
Gamescore6=0,
Gamescore7=0,
Gamescore8=0,
Gamescore9=0,
}
--Gamescore1=0
function addscore1()
G.Gamescore1=G.Gamescore1+1
-----------------------------------------------------------
end
----------------------------------------------------------
function addscore2()
G.Gamescore2=G.Gamescore2+1
end
---------------------------
function addscore3()
G.Gamescore3=G.Gamescore3+1
end
function addscore4()
G.Gamescore4=G.Gamescore4+1
end
function addscore5()
G.Gamescore5=G.Gamescore5+1
end
Gamescore6=0
function addscore6()
G.Gamescore6=G.Gamescore6+1
end
function addscore7()
G.Gamescore7=G.Gamescore7+1
end
function addscore8()
G.Gamescore8=G.Gamescore8+1
end
function addscore9()
G.Gamescore9=G.Gamescore9+1
end
Note: the Gamescore variables are to get to the next level if the Gamescore = 1 the next level will be unlocked.
So every time an addscore function is activated I need to save the new Gamescore.
Example: Gamescore1 = 0
the addscore1 function is triggered so now Gamescore1 = 1. The next level is unlocked if Gamescore1 = 1. I have all that set. Now I only need to save Gamescore1 with its new value (1).
I hope this is enough information. I would really appreciate it if someone could help me.
Thanks in advance!