On 28 Mar 08, at 18:37, Mario Gajardo Tassara wrote:
In a portion of code of my app (collision detection part) i need to remove an object from an array of objects, when two distinct objects crashed i decrement a life counter, and if this is equal to zero the object must be destroyed, but when the counter reach de zero and the object is destroyed my app crash. Some one can help me with this problem, here is the code, and thanks in advance:
You're removing an object from an array while iterating through it. Think carefully about what this is doing to the indexes of objects in the array, and you'll probably see what's going on.
You probably ought to move to some sort of "mark-and-sweep" algorithm here, rather than mutating the array while iterating through it.
_______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
