onDestroy(tag: Tag, action: (obj: GameObj)=>void): KEventController
Register an event that runs when an object with the provided tag is destroyed.
param
tag- The function that runs when an object is destroyed.
// This will run when the tagged object is destroyed. onDestroy("bean", () => { debug.log("ohbye"); }); let player = add([ pos(), "bean" ]) // Destroy the tagged object destroy(player);
returns
The event controller.
since
v2000.0