Hi
i’ve got a demo where a bunch of objects fall from the sky. if they bounce off screen they get removed. if certain types touch they get removed.
The problem i’m seeing is that when i’m dragging a body and i either drag it off screen (killing it) or it collides with another and gets destroyed, then no further drag events work on the other objects
thanks for any info on how i might fix this
regards
j
[lua]for i=#ballsToRemove,1,-1 do
ballToRemove = ballsToRemove[i]
idx = TableUtils.indexof(balls,ballToRemove)
idx2 = TableUtils.indexof(ballsToRemove, ballToRemove)
if(ballToRemove~=nil) then
if(idx~=nil) then
– remove the sprite & physics
local sp = ballToRemove.sprite
sp:removeEventListener (“touch”, dragBody)
sp:removeSelf()
spriteCount = spriteCount - 1
– remove ball from ball arrays
TableUtils.splice(balls,idx)
TableUtils.splice(ballsToRemove, idx2)
end
end[/lua] [import]uid: 6645 topic_id: 3526 reply_id: 303526[/import]
