I have five boxes and one circle… They both have collision detection. Each box is draggable. Just wondering if anybody knows how to keep track of how many boxes has hit the circle when collided. I want to do something similar to what is in martian controls… [import]uid: 51459 topic_id: 14161 reply_id: 314161[/import]
Well I guess it depends on what you mean by that. Are you wanting a count of the number of times the circle is hit or do you want to know when each box has hit the circle?
For the first just add a property and increment it each time the circle detects a collision, i.e.
circle.hitcount = circle.hitcount + 1
If you want to know if each box has hit the circle, if you can do the same thing, except for the box.
Init it like:
box1.hasHitCircle = false
then in the collision detection function:
event.target.hasHitCircle = true
(assuming that event.target = the box that collided)
You could also do this from the circle’s perspective, letting it detect the collisions. At that point, the box should be event.other (I think)
[import]uid: 19626 topic_id: 14161 reply_id: 52109[/import]
Thanks Rob that helps out a bunch!! [import]uid: 51459 topic_id: 14161 reply_id: 52110[/import]