Home / Topic / Memory game tutorial outdated?

Memory game tutorial outdated?

Home Kwiksher Forums Help me! Memory game tutorial outdated?

Viewing 8 posts - 1 through 8 (of 8 total)

    Hello Alex, I’m trying to create the memory game tutorial, but it seems corona gives me some errors back, i found in corona labs forums some changes that may need to do, but even those didn’t fixed it.

    Corona Labs Link

    And here is a Screenshot (or two) of the error i get from Corona Simulator.

    What is wrong here?
    Are all the tutorials updated to the this version of Kwik?

    Thank you very much.


    I have also struggled with this game, but managed after a couple of days to do what I want and run it smoothly in the Simulator.
    If you read the posting just below this one (about External Code) you will find lots of information about it.
    I had a quick look at your code and noticed that you have not converted the code (everything explained in the posting above referred to).The conversions are very few and easy to do.
    For instance, you have
    There is no more menuGroup, now is sceneGroup
    imgDir.. “p10_image”
    it must be:composer.imgDir.. “p10_image”
    These are two examples where you have got it wrong.
    Another point: how many individual cards do you have?
    Hope it helps.



    Thank you, I ll give it a second try.


    I continually get the errors, even now that i made some changes thanx to Jorge (thank you again!).

    the external code that i use is the following :

    – verifies number of flips
    if (flips < 2) then — flips the clicked card
    composer.trans.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
    elseif flips == 2 then –second flip in the round
    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 –check if the clicked card is the same previous clicked
    composer.trans.newTransition_743 = transition.to( self, {alpha=0, time=1000, delay=0})
    table.insert(flipped,self) — updates the content of flipped table
    – if you have more than 8 cards, you must review this line here, as it was written to capture only the last character of the picture name.
    – For example, p1_photo1 will return “1″.
    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
    – cards don’t match
    local function hideAgain()
    composer.trans.newTransition_898 = transition.to( flipped[1], {alpha=1, time=1000, delay=0})
    composer.trans.newTransition_888 = transition.to( flipped[2], {alpha=1, time=1000, delay=0})
    local function zeroesFlip()
    flips = 1
    flipped = {}
    composer.timerStash.timer_fl = timer.performWithDelay( 1000, zeroesFlip, 1 ) –timer to avoid users to flip other cards while the current ones are shown
    composer.timerStash.timer_AP = timer.performWithDelay( 2000, hideAgain, 1 ) –timer to block the cards again, with the cover image

    and from another external file this: – Shuffle cards
    while #tList ~= 0 do –loops the tLista table until it is empty
    local ind = math.random(#tList) — get a random number/position from the tList table
    table.insert(randList, tList[ind]) –insert the selected card into table randList
    table.remove(tList,ind) — remove the card from the tList table

    – Positions each photo
    – olds each card position in the table (you can get this info from each Photoshop layer or
    – simply Publish your project and read the coordinates from your Lua page
    local cards = { {141,189}, {387,189}, {635,189}, {881,189}, {141, 378}, {387,378}, {635,378}, {881,378} }
    local card = {} — table to draw each card
    for i = 1,#randList do –loops the content of the randList
    card[i] = display.newImageRect( composer.imgDir.. “p1_photo”..randList[i]..”.jpg”, 220, 165 ); — reads the external file with the card name
    card[i].x = cards[i][1]
    card[i].y = cards[i][2]

    – This is not needed. I just added it to show in the console the new position of each card (so, you will be able to check where each card is in the board
    for i,v in ipairs(randList) do print(i,v) end

    I tripple checked everything in Photoshop (CS6), i have the latest corona simulator and of course the latest Kwik (paid) plugin… still i get errors…

    I dont get it. 🙁

    p.s. Sorry for the code in the second part but it seems that the forum doesnt like two code windows in a row.

    • This reply was modified 5 years, 11 months ago by DELIVERANCE98.
    • This reply was modified 5 years, 11 months ago by DELIVERANCE98.
    • This reply was modified 5 years, 11 months ago by DELIVERANCE98.

    Your issue may be in the lines with quotes. if you simply copied and paste the code above, the quotes will be wrongly written. Try to delete and enter new quotes in EVERY line of your external code. If you want to check this project running perfectly in Kwik 3, just download it from here: http://www.kwiksher.com/tutorials/Memory/memory3.zip


    Thank you Alex, this is a good boost in my efforts to make it work, i downloaded the file that you added and it is running ok on Corona SDK.
    My only thing is that i cannot open it on kwik, even though it has its .kwk file in it.
    I used Notepad++ to open the .kwk file and replaced the path of your system folder to mine, still i can’t open it 🙁

    I ‘ll try it again tomorrow, i may misunderstand something.. i don’t know.

    Edit: I made the file to open right, i had to use the same name for the folder as the project and not some random one, so i did, it opened.

    Lets summarize for anyone who needs to take the same steps as me: Alex kindly shared a zip file created with Kwik 3 for the memory game tutorial, now this file is working, but you have to open the memoryTest.kwk file in a text editor and change the path of the file (that point to alex folder in his computer) to your current path in your computer. This and keep in mind to have the folder of the project named as memoryTest will be all that you need to open the project in kwik.

    Thank you both for your help.

    • This reply was modified 5 years, 11 months ago by DELIVERANCE98.

    No need to edit the kwk file. Simply create a folder with the same name of the kwk file under your default project folder and copy the zip contents there.

Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘Help me!’ is closed to new topics and replies.