【发布时间】:2016-07-16 02:16:15
【问题描述】:
美好的一天,有一段时间我正在尝试将我的表保存在 Corona SDK 中。退出和进入游戏时,解锁的关卡仍然需要解锁。
我已经尝试了几件事,但我仍然无法弄清楚。 我怎样才能做到这一点?
这是我的代码的一部分:
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
注意:Gamescore 变量是为了更上一层楼 如果 Gamescore = 1,则将解锁下一关。
因此,每次激活 addcore 功能时,我都需要保存新的 Gamescore。
示例: 游戏分数1 = 0
addscore1 函数被触发,所以现在 Gamescore1 = 1。 如果 Gamescore1 = 1,则解锁下一个级别。我拥有所有这些设置。现在我只需要用新值 (1) 保存 Gamescore1。
我希望这是足够的信息。如果有人可以帮助我,我将不胜感激。
提前致谢!
【问题讨论】: