onTag(action: (obj: GameObj , tag: string )=>void ): KEventController

Register an event that runs when an object gains a tag.

paramaction- The function that runs when the event happens.

onTag((obj, tag) => {
    debug.log(`A new tag ${tag} was added to the object ${obj.id}`);
});

returnsThe event controller.

sincev3001.1

groupEvents

onTag(tag: Tag , action: (obj: GameObj , tag: string )=>void ): KEventController

Register an event that runs when an object with the provided tag gains a tag.

paramtag- The function that runs when the event happens.

onTag("elephant", (obj, tag) => {
    debug.log(`A new tag ${tag} was added to the object ${obj.id}`);
});

returnsThe event controller.

sincev3001.1

groupEvents