I want to show some images on the simulator
when I tap the first time nothing happen, in the second tap appears the first pad,
but in the third tap appears two pads ,but in the pad number one appears another pad,
so I have two pads in the first position an one in the second position. In the third tap appears
three pads in the first position, two pads in the second position an one pad in the third position.
I don’t want pads in the same positions.
local pads = {}
local idx = 0
cantidad=0
local function tapDisplayImages()
for y = 1, 1 do
for x = 1, cantidad do
idx = idx + 1
local pad = display.newImageRect(“images/lilypad_green.png”, 64, 64)
pad.x = (x * 75) - 23
pad.y = y * 70
local sizer = 1 + math.random(-1, 1) / 10
pad:scale ( sizer, sizer )
pads[idx] = pad
pads[idx].idx = idx
end
end
cantidad=cantidad+1
print(“tapped”)
end
button = display.newImage(“images/button.png”, 100, 195)
button.x = 152
button.y = 170
button:addEventListener ( “tap”, tapDisplayImages )