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).

sincev2000.1

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