Game Development Community

Multiple behaviors that have onCollision functions.

by Sean Xie · in Torque 2D Beginner · 02/16/2014 (9:09 pm) · 2 replies

If I have a Sprite with a behavior that implements an onCollision function, then when a collision happens the system will call this onCollision function. But what if I have multiple behaviors and each one implements one onCollision function? Will the system call each of them when a collision happens?
It seems to me that only one of them is called in my program.

#1
02/16/2014 (9:18 pm)
You should be able to use signals - just create signal connections from your onCollisionRaised to all of the desired behaviors' catchCollision methods. See "Behavior Connections" in the Wiki....
#2
02/17/2014 (4:51 am)
What Richard said. Try signals.