-2
我想模擬西蒙說遊戲。我目前使用Corona SDK,並使用Lua作爲我的語言。爲什麼這段代碼不能啓動?
我已經把addEventListener(touch)
放在函數「開始」上。我已經試過調試它,並且它似乎代碼沒有正確運行說,if (started) then
聲明的部分。如果你們能夠幫助我走向正確的方向,我將非常感激!
這裏是我的代碼部分:
local function starting(event)
if (started == false) then
started = true
end
if (event.phase == "ended") then
start()
startText.isVisible = false
---------------------------------------------------
--THIS BELOW PART IS WRONG-- does not do "started"
if (started) then
count = count + 1
--if started--
if(math.mod(count,20) == 0) then
clicked = 0
if(light >= 0) then
light = light - 1
end
end
「不正確運行」是什麼意思?你初始化了嗎? – ryanpattison
只是初始化開始=零或假。 –
錯誤可能會比零更好。但它並不重要 –