onCollide(t1: Tag, t2: Tag, action: (a: GameObj, b: GameObj, col?: Collision)=>void): KEventController

Register an event that runs once when 2 game objs with certain tags collides (required to have area() component).

paramt1- The tag of the first game obj.

paramt2- The tag of the second game obj.

paramaction- The function to run when the event is triggered.

onCollide("sun", "earth", () => {
    addExplosion()
})

returnsThe event controller.

sincev2000.1

kaplay logo

Misc

Layer