限制 Corona SDK 中的移动

Limiting Moves In Corona SDK

我正在 Corona SDK 中创建 Match-3 游戏,我想限制玩家在调用游戏结束之前可以进行的移动(或回合)数量。我也想把它展示给玩家。谁能帮我完成这个,因为这是我的第一个大项目。

去年我完成了一场三消比赛,有一个例子可以帮助你:

local moves_count = 10 -- limite 10 moves

--Called move_success when player moved two cells succeed
function move_success()
    --Your code here
    --XXX
    --
    moves_count = moves_count - 1
    update_moves_display()
    check()
end

function check()
    --Your code here
    --XXX
    --

    while true do
        if XXXX then --level clear
            level_clear()
            return
        end

        if check_out_of_moves() then
            level_failed("outofmoves")
            return
        end

        --Check others you want
        --Your code here

        --
        return
    end
end

function update_moves_display()
    --Your code here
    --XXX
    --
end

function check_out_of_moves()
    return moves_count == 0
end

function level_failed(info)
    --Your code here
    --XXX
    --
end

function level_clear()
    --Your code here
    --XXX
    --
end

PS:我的英语不是很好,请原谅。 ^_^