Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:14:19+00:00 2026-06-07T13:14:19+00:00

I am trying to match images on Corona. I created images and matches array

  • 0

I am trying to match images on Corona. I created images and matches array variables and insert the display objects inside those arrays. However, i can’t figure it out how i will be able to move one of the same objects onto other and make it disappear. Can you help me out? Thanks.

Here is my code so far:

    local images={}
    local matches={}

    local function onTouch( event )
       local t = event.target
       local phase = event.phase

if "began" == phase then
    -- Make target the top-most object
    local parent = t.parent
    parent:insert( t )
    display.getCurrentStage():setFocus( t )

    t.isFocus = true
elseif t.isFocus then
    if "moved" == phase then
        t.x = event.x
        t.y = event.y 
elseif "ended" == phase or "cancelled" == phase then
        display.getCurrentStage():setFocus( nil )
        t.isFocus = false
    end
end

  return true
   end



  local arguments =
   {
{img="img1.png" , x=30, y=30 },
{img="img2.png", x=100, y=30},
{img= "img3.png",x=170, y=30},
   }    

    local arguments2={

{img= "img1.png",x=30, y=150},
{img= "img2.png",x=100, y=150},
{img= "img3.png",x=170, y=150}

     }

   for _,item in ipairs( arguments ) do
local imgg = display.newImage( item.img,item.x,item.y )

table.insert(images,imgg)
-- Make the button instance respond to touch events
imgg:addEventListener( "touch", onTouch )
   end

   for _,item in ipairs( arguments2 ) do
local imgg = display.newImage( item.img,item.x,item.y )

table.insert(matches,imgg)
-- Make the button instance respond to touch events
imgg:addEventListener( "touch", onTouch )
   end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:14:20+00:00Added an answer on June 7, 2026 at 1:14 pm

    It would be easiest to assign a type or the like to each image, eg;
    {img=”img1.png” , x=30, y=30, type=”red” }

    Then when it is released check whether or not it is within the content bounds of the matching image in the other arguments table using object.contentBounds (you can find detailed info about this on the Corona Labs API page.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to match variables in some PHP code which are missing their leading
I am trying to match any url that has /images/ , /styles/ , or
I am trying to create app which is match text with appropriate images by
I am trying to match (using regex in python): http://images.mymaterials.com/images/steel-images/small/steel/steel800/steel800-2.jpg in the following string:
I am trying to display images vertically 5 per row using php and I
I am trying to create an array of all images from the saved photo
I am trying to create a simplified code to insert images dynamically into a
I am trying to match two index values between slider big images and it's
I am new to Android programming, now I am trying to place images inside
I'm trying to match jpeg images in HTTP GET requests. For example in :

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.