passThroughController
Permet à un joueur de passer à travers certains blocs
triggers on self
"passing through""moved"parameters
| Parameter | Default Value | Type | Description |
|---|---|---|---|
downKey | string | 'down' |
example
passThroughController({ downKey: 'down'}),function passThroughController(p) { const param = { downKey: 'down', ...p, }; return { id: 'pass though', add() { onKeyPress(param.downKey, () => (this.isPassingThrough = true)); this.onCollideEnd('pass through', () => (this.isPassingThrough = false)); this.onBeforePhysicsResolve((col) => { if ( col.target.is('pass through') && (this.isPassingThrough || this.isJumping()) ) { col.preventResolution(); this.trigger('passing through'); this.trigger('moved'); } }); }, };}