Touch Managing
Vmlweb
Member Posts: 427
Hey,
I have a actor called zombie.
Is there any way to get how many zombie actors are touching an object at once?
Thanks,
Victor
I have a actor called zombie.
Is there any way to get how many zombie actors are touching an object at once?
Thanks,
Victor
Comments
In the zombie actor, add two boolean attributes called:
isTouchingObject
hasAddedToZombieTouches
Add a rule that says:
When Actor touches or collides with Actor of type (your object here)
Change Attribute: self.isTouchingObject to TRUE
Otherwise
Change Attribute: self.isTouchingObject to FALSE
Another rule that says:
ALL
When self.isTouchingObject is TRUE
When self.hasAddedToZombieTouches is FALSE
Change Attribute: game.zombieTouches = game.zombieTouches + 1;
Change Attribute:self.hasAddedToZombieTouches to TRUE
And another rule that says:
ALL
When self.isTouchingObject is FALSE
When self.hasAddedToZombieTouches is TRUE
Change Attribute: game.zombieTouches = game.zombieTouches - 1;
Change Attribute:self.hasAddedToZombieTouches to FALSE
Hope this helps!
Joe
thanks