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 8111847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:16:17+00:00 2026-06-06T02:16:17+00:00

i have a problem (obviusly :P) i’m create a mini game, and when i

  • 0

i have a problem (obviusly :P)

i’m create a mini game, and when i touch a Object-A , creates an Object-B.
If i touch N times, this create N Object-B.

(Object-B are Bubbles in my game)

so, i try when I touch the bubble (object-B), that disappears or perform any actions.
I try adding Object-B to Array

local t = {}

.
.
.

bur = display.newImage("burbuja.png")
table.insert(t,bur)

and where i have my eventListeners i wrote:

for i=1, #t do
bur[i]:addEventListener("tap",reventar(i))
end

and my function ‘reventar’

local function reventar (event,id)
table.remove(t,id)
end

i’m lost, and only i want disappears the bubbles.

  • 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-06T02:16:19+00:00Added an answer on June 6, 2026 at 2:16 am

    you’re probably gonna want to do something like this:

    local t = {}
    
    bur = display.newImage("burbuja.png")
    table.insert(t,bur)
    
    -- declaring the function first so it can be used later in the for loop
    local function reventar(event)
        t[event.target.id] = nil         -- We remove object from table
        event.target:removeSelf()        -- Also remember to remove from display
    end
    
    for i=1,#t do
        t[i].id = i
        t[i]:addEventListener("tap", reventar)
    end
    

    Hope this helps.

    EDIT

    I would do it this way, because it’s better when you want to loop through the objects:

    local t = {}
    
    -- declaring the function first so it can be used later
    local function reventar(event)
        event.target.kill = true     -- Mark the clicked object for later destruction
    end
    
    bur = display.newImage("burbuja.png")
    bur:addEventListener("tap", reventar)
    table.insert(t,bur)
    
    local function loop(event)
        for i = #t, 1, -1 do
            local object = t[i]
    
            -- Do stuff to object here, such as object.y = object.y + 1
    
            if object.kill then   -- Check if object is marked for destruction
                local child = table.remove(t, i)    -- Remove from table
                if child ~= nil then
                    -- Remove from display and nil it
                    child:removeSelf()
                    child = nil
                end
            end
        end
    end
    
    Runtime:addEventListener("enterFrame", loop) -- Remember to remove this when no longer needed
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with my query on C, I’m using the oci8 driver. This
I have a problem in customizing labels in a Django form This is the
I am new to ADO.net and have this problem: Let's assume I have these
I have problem understanding the order in which initialization happens. this is the order
I have a problem which is similar to this stackoverflow I am sending a
i have this problem that has been buggin me for the last hours. Lets
basically i have this problem i have a table of posts(in my mysql database)
I have a problem that I have not seen addressed in this particular way
I have this problem with sessions in PHP which I have never been able
I have a problem with my Authentication HttpModule. The problem is that it obviously

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.