Hi, I’ve created a function to create an overlay circle and spawn the circle 6 times.
These overlays are then repositioned on the screen.
My question is, how do I add EventListeners to each of these 6 instances of the circle object.
Imagine that they are all 6 different buttons and I want to make it so that when a user touched an instance of a circle, it pops up different messages.
Thank you.
overlayTable = {} --// FUNCTION: Create overlay local function createOverlay() circleOverlay = display.newCircle(\_W, \_H, 45); return circleOverlay end -- Create 6 overlays: for i = 1, 6 do overlayTable[i] = createOverlay() end -- Reposition overlays: overlayTable[1].x = (\_W \* 0.5) - 150; overlayTable[1].y = (\_H \* 0.5) - 50; overlayTable[2].x = (\_W \* 0.5) - 155; overlayTable[2].y = (\_H \* 0.5) + 65; overlayTable[3].x = (\_W \* 0.5) + 3; overlayTable[3].y = (\_H \* 0.5) - 80; overlayTable[4].x = (\_W \* 0.5) - 3; overlayTable[4].y = (\_H \* 0.5) + 60; overlayTable[5].x = (\_W \* 0.5) + 160; overlayTable[5].y = (\_H \* 0.5) - 60; overlayTable[6].x = (\_W \* 0.5) + 155; overlayTable[6].y = (\_H \* 0.5) + 60;