I am creating a Match-3 game in Corona SDK, and I would like to limit the amount of moves(or turns) a player can make before a gameover in called. I'd also like to display it to the player. Can anyone help me accomplish this, as this is my first big project.
Last year I finished a match-three game and there is an example for you to help:
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:My English is not very good, pardon me. ^_^