interactive
Permet à un objet d'être activé par un joueur
parameters
| Parameter | Default Value | Type | Description |
|---|---|---|---|
switch | boolean | false |
example
interactive({ switch: false}),function interactive(p) { const param = { switch: false, ...p } return { interactOn: false, add() { this.onCollide("interact", (e) => e.addInteractObject(this)) this.onCollideEnd("interact", (e) => e.removeInteractObject(this)) }, activate(p) { (this.interactOn) ? this.trigger("disactivated", p) : this.trigger("activated", p) if (param.switch) this.interactOn = !this.interactOn }, }}