Orientation de la sprite
L’image représentant ton personnage a peut-être une direction. Ce hack te permetttra d’afficher ton personnage dans la diretion vers la quelle il se déplace.
Créer un composant
Section intitulée « Créer un composant »component.js function spriteFacing(p) {const param = {reversed: false,...p}return {update() {this.flipX = (this.facing > 0) ? (param.reversed) : !(param.reversed)},}}modifier le joueur
Section intitulée « modifier le joueur »config.js "#": () => [ // player 1spriteFacing(),sprite("bean"),platformerController(),alive(),opacity(),scale(),health(1, 4),area(),anchor("bot"),body(),respawn(),falling(),],
Paramètres
Section intitulée « Paramètres »exampleconfig.js
spriteFacing({ reversed: false}),