【问题标题】:If score is higher than 5 then如果分数高于 5 则
【发布时间】:2013-09-19 20:00:31
【问题描述】:

所以如果我的分数高于 5 则 gotoSceneA elseif gotoSceneB。
但是我收到了这个错误:

game.lua:439: unexpected symbol near '..'*

如果我删除 .. 我得到:

game.lua:443: 'then' expected near 'end'

我的代码:

if .. score > 5 then
    storyboard.gotoScene("bonus", "fade", 400)
elseif
    storyboard.gotoScene("gameover", "fade", 400)
end
end

【问题讨论】:

  • 请将elseif 更改为else。此外,您应该删除..
  • 另外,您应该删除带有end 的最后一行。一个if then/else 语句不需要多个结尾。

标签: lua coronasdk corona-storyboard


【解决方案1】:
if score > 1000 then
    storyboard.gotoScene("bonus", "fade", 400)
else
    storyboard.gotoScene("gameover", "fade", 400)
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-01
    • 2011-11-26
    • 2023-03-26
    • 2012-12-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多