Hi,
I am trying to add objects to a group and then remove them as needed but I am having a hard time removing them.
Here is my code:
I initiate the group
onTarget = display.newGroup ()
Then below I insert the newly created object when it collides with the scope:
if( event.phase == "began" and event.other.myName == "circle") then
onTarget:insert(newMo)
--onTarget[onTargetID] = newMo
--onTargetID = onTargetID + 1
--onTarget =newMo
newMo.killable = true
scope.scopeSnap()
--scope.scope.x = newMo.x Makes the physics engine crash
--scope.scope.y = newMo.y
end
if(event.phase == "ended" and event.other.myName == "circle") then
event:remove(newMo.onTarget)
--onTarget = nil
newMo.killable = false
scope.scopeUnsnap ()
end
I am trying to remove it when it goes out of scope.
Thanks for your help. [import]uid: 8192 topic_id: 2205 reply_id: 302205[/import]