限制Corona SDK中的移动

我正在使用 Corona SDK 制作一个 Match-3 游戏,我想限制玩家在游戏结束前可以进行的移动(或回合)次数,并将其显示给玩家。由于这是我第一个大型项目,有谁能帮助我实现这个功能呢?

点赞
用户3974215
用户3974215

去年我完成了一个三消游戏,这里有一个示例供您参考:

local moves_count = 10 -- 限制为10步

--当玩家移动两个格子成功时调用move_success函数
function move_success()
    --你的代码在这里
    --XXX
    --
    moves_count = moves_count - 1
    update_moves_display()
    check()
end

function check()
    --你的代码在这里
    --XXX
    --

    while true do
        if XXXX then --过关
            level_clear()
            return
        end

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

        --检查其他东西
        --你的代码在这里

        --
        return
    end
end

function update_moves_display()
    --你的代码在这里
    --XXX
    --
end

function check_out_of_moves()
    return moves_count == 0
end

function level_failed(info)
    --你的代码在这里
    --XXX
    --
end

function level_clear()
    --你的代码在这里
    --XXX
    --
end

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

2015-12-22 03:45:49