Hey team,
First off, I don’t code.
I use Kwik and Corona. But by using one of the Kwik tutorials (http://www.kwiksher.com/tutorials-kwik/creating-a-memory-game/) I managed to get a basic memory game working (before the Corona storyboard update).
Now it’s changed I’m lost!!!
I’m not sure what I’m meant to change to make it work? I’m currently trying to get a build done to get my app in the Google Play store, but can’t get it to work
Could someone take a look at these two blocks of code (the only external code I’m using for the game which I think is causing the problems) and help me out with what needs to be changed?
-- Shuffle cards while #tList ~= 0 do local ind = math.random(#tList) table.insert(randList, tList[ind]) table.remove(tList,ind) end -- Positions each photo local cards = { {579,562}, {1044,562}, {1508,560}, {1973,560}, {577,1014}, {1042,1005}, {1508,1005}, {1973,1005} } --holds each card position in the table local card = {} -- table to draw each card for i = 1,#randList do card[i] = display.newImageRect( imgDir.. "p10\_image"..randList[i]..".png", 416, 406 ); card[i].x = cards[i][1] card[i].y = cards[i][2] menuGroup:insert(card[i]) end for i,v in ipairs(randList) do print(i,v) end
and…
--External code print("flips: "..flips) -- verifies number of flips if (flips \< 2) then transitionStash.newTransition\_743 = transition.to( self, {alpha=0, time=1000, delay=0}) -- blocks tentatives to press the same card if flipped[1] ~= self then --check if the entry is the same as the first one flips = flips + 1; if flips \> 2 then flips = 2 end -- updates the number of flips table.insert(flipped,self) -- updates the content of flipped table end elseif flips == 2 then flips = flips + 1 --; if flips \> 2 then flips = 2 end -- two flips made -- blocks tentatives to press the same card if flipped[1] ~= self then transitionStash.newTransition\_743 = transition.to( self, {alpha=0, time=1000, delay=0}) table.insert(flipped,self) -- updates the content of flipped table if (randList[tonumber(string.sub(string.reverse(flipped[1].name),1,1))] == randList[tonumber(string.sub(string.reverse(flipped[2].name),1,1))]) then --equal images, move buttons to out of screen flipped[1].x = 5000 flipped[2].x = 5000 flips = 1 -- returns the number of flips to 1 flipped = {} --cleans the flipped table GameWins = GameWins+1 if GameWins == 4 then act\_winner() end else -- cards don't match local function hideAgain() transitionStash.newTransition\_898 = transition.to( flipped[1], {alpha=1, time=1000, delay=0}) transitionStash.newTransition\_888 = transition.to( flipped[2], {alpha=1, time=1000, delay=0}) local function zeroesFlip() flips = 1 flipped = {} print("flips:"..flips) end timerStash.timer\_fl = timer.performWithDelay( 1000, zeroesFlip, 1 ) --timer to block the cards again, with the cover image end timerStash.timer\_AP = timer.performWithDelay( 1750, hideAgain, 1 ) --timer to block the cards again, with the cover image end end end
Thanks in advance.
Cheers,
(going a little bat crazy!)