Hi all, I’m new to Corona and could do with some help.
I got the below code from another post on this forum and have tweaked it a little bit…
[lua]local function tapRect(event)
print(“clicked rect:”…event.target.tag)
end
local i = 1
for row = 1,5 do
for col = 1,5 do
local rect = display.newRect(col * 85, row * 85,75,75)
rect.tag = i
i= i + 1
rect:addEventListener(“tap”,tapRect)
end
end [/lua]
It works well except the whole grid is offset, I would like it 10 from left and top but because of the way the math is written, this cannot work.
Could anyone help me change it so that this is the case.
I would eventually swap the squares for different images.
Appreciate any help.
Dan. [import]uid: 107975 topic_id: 18955 reply_id: 318955[/import]