spring
Permet à un objet de faire rebondinr les objets qui se trouvent dessus
triggers on self
"spring"triggers on others
"spring"parameters
| Parameter | Default Value | Type | Description |
|---|---|---|---|
power | number | 1200 | |
tag | string | "body" |
example
spring({ power: 1200, tag: "body"}),function spring(p) { const param = { power: 1200, tag: "body", ...p } return { id: "spring", add() { this.onCollide(param.tag, (obj, col) => this.checkSpringColission(obj, col)) }, checkSpringColission(obj, col) { if (col.isTop()) { obj.jump(param.power) this.trigger("spring") obj.trigger("spring") } }, }}