Remove an object on collision.

Ok so i have an image which is a circle and that’s my object…i have that object spawning hundreds of time and falling down… when the circle hits the floor i want it to removeself or display.remove? i want the object set as an individual be cause if i don’t when one circle hits the floor other circles disappear as its the same object. thanks

id like some code maybe? cause ive tried lots of things with no success 

thanks again!

Is this the same question you’ve already asked where we are suggesting how to remove things?

This is for a different project …

ive tried this code 

 local function cirlceRemove() circle:removeSelf() circle=nil end local function onLocalCollision( self, event ) if ( event.phase == "began" ) then timer.performWithDelay(50, circleRemove) end end circle.collision = onLocalCollision

circle:addEventListener( "collision", circle ) \<--- error for that..

but its giving me an error for this 

saying that 

Runtime error

c:\user\laptop\desktop\game\game2.lua:53: attempt to call method ‘addEventListener’ (a nil value)

Where are you creating the circle? 

The circle are being randomly created from right above the screen and falling

Is “circle” in the proper scope? Where do you actually declare it? If you’re creating multiple circles (like many randomly spawned objects) you should probably reference “self” in the collision listener, or pass “self” to the “circleRemove” function in order to reference that object, instead of directly pointing to “circle”. Just safer that way if you’re creating many of these objects.

Brent

https://forums.coronalabs.com/topic/57301-how-to-make-an-object-an-individual/

thats another post of mine and it refers a bit to another project but could help me in this one if you answer it? thanks

Is this the same question you’ve already asked where we are suggesting how to remove things?

This is for a different project …

ive tried this code 

 local function cirlceRemove() circle:removeSelf() circle=nil end local function onLocalCollision( self, event ) if ( event.phase == "began" ) then timer.performWithDelay(50, circleRemove) end end circle.collision = onLocalCollision

circle:addEventListener( "collision", circle ) \<--- error for that..

but its giving me an error for this 

saying that 

Runtime error

c:\user\laptop\desktop\game\game2.lua:53: attempt to call method ‘addEventListener’ (a nil value)

Where are you creating the circle? 

The circle are being randomly created from right above the screen and falling

Is “circle” in the proper scope? Where do you actually declare it? If you’re creating multiple circles (like many randomly spawned objects) you should probably reference “self” in the collision listener, or pass “self” to the “circleRemove” function in order to reference that object, instead of directly pointing to “circle”. Just safer that way if you’re creating many of these objects.

Brent

https://forums.coronalabs.com/topic/57301-how-to-make-an-object-an-individual/

thats another post of mine and it refers a bit to another project but could help me in this one if you answer it? thanks