I've had several situations in C2 where I've wanted to trigger a function call once, and only once, when two objects in different families come within a given range of one another - similar to an 'on Collision' trigger, but I need it to happen before the objects actually collide.
I've dived into this problem a little bit more tonight, and at first I thought it was a bug, but now I think I may just be misunderstanding something about what's happening in the engine.
Here's a capx to demonstrate:
https://dl.dropboxusercontent.com/u/616 ... eport.capx
In this scene, there are 2 families of squares, Blue and Red. The intended behavior is that whenever two squares in different families enter a radius of 200 px from one another, they should each fire off a single bullet of their color at the closest member of the other family.
This seems to work fine, except in the case where BOTH blue squares are within range of one or both Red squares - at that point, the event stops behaving as a 'trigger once while true' and starts to fire every tick.
Can anyone explain why this is happening? I can think of a couple of workarounds for this problem, but I'm more interested in understanding the underlying reason why this particular situation doesn't work.
And better yet - what *is* the simplest way to trigger an event once and only once when members of different families enter into a given range of one another? I'm looking for a solution where for at least one of the families, I won't know the exact number or type of the family members.
Thanks for any insight or help anybody can offer!