1 decade ago by nholbert
It seems that check( other ) runs even on _killed entities.... is this intentional?
My situation is this... I've basically got a grid of entities that can be moved around by mouse clicks. Somewhat frequently I clear out all the entities (by kill()), and then repopulate it with new entities. When moving the live entities around, I want to check to see when two entities (living ones) overlap. Unfortunately, check() runs against both the live entities as well as those "_killed" entities that I had cleared previously.
I can make it work by putting the code that results from the check inside of: if (!other._killed)... but it seems a little odd that I need to do this...
Thoughts?
My situation is this... I've basically got a grid of entities that can be moved around by mouse clicks. Somewhat frequently I clear out all the entities (by kill()), and then repopulate it with new entities. When moving the live entities around, I want to check to see when two entities (living ones) overlap. Unfortunately, check() runs against both the live entities as well as those "_killed" entities that I had cleared previously.
I can make it work by putting the code that results from the check inside of: if (!other._killed)... but it seems a little odd that I need to do this...
Thoughts?