Hi All,
I have a quick question on tables in Corona.
I have a table that contains images:
local images = { one="1.png", two="2.png", three="3.png", four="4.png" }
I have built a logic that moves this images around on the screen. At certain point in time, when all the images are in their correct place, I would like to call a function.
My issue is that I can’t seem to figure out how to write code which will know that images are in their designated place and its time to call the required Function. For example, my understanding is that if I have my 1.png’s x and y location to be 10 and 0, respectively, and if I use the following code then I should be able to figure out if the 1.png is at its correct place or not. I’m using this code:
if images.one.x = 10 and images.one.y = 0 then
-- certain code goes here
end
but it is not working for me, which obviously concludes that I’m doing something wrong.
I thought about setting reference point of my images by using the following line of code:
images.one.x:setReferencePoint( display.TopLeftReferencePoint )
but again its not working for me.
Can someone please point me in right direction? This is my first code and I’m planning to make it available on Corona once it is finished so other beginners can learn faster.
Please let me know if you would like to provide me additional information.
Any help would be very much appreciated!
Thanks
JP [import]uid: 82666 topic_id: 23849 reply_id: 323849[/import]