I havce the following code for a card matching game I’m creating to take a look at Corona:
function detectMatch()
if flipped == 2 then
if string.match(cards[flips[1]].name, "%d+") == string.match(cards[flips[2]].name, "%d+") then matches = matches - 1
else
print("hey", cards[flips[1]].name, cards[flips[2]].name)
cards[flips[1]].alpha = 0
cards[flips[1]].isVisible = false
cards[flips[2]].alpha = 0
cards[flips[2]].isVisible = false
end
flips = {}
flipped = 0
end
end
and the function card:tap event which uses it:
drawGameBoard()
for posCard, card in ipairs(cards) do
function card:tap( event )
flipped = flipped + 1
table.insert(flips, posCard)
transition.to( card, { time = 500, alpha=1.0} )
detectMatch()
end
card:addEventListener( "tap", card)
end
When it is ran through the simulator, it only converts the most recent card to alpha=0, and not the other one that came before it. was wondering if anyone had any insight or further places to look for using the tap event with multiple buttons. i have a 6x6 card game where if two cards match, then they stay visible and untouchable, but if two cards don’t, they flip back over. [import]uid: 3551 topic_id: 192 reply_id: 300192[/import]