Double saut
Andy
Le double saut permet de donner plus de contrôle au joueur dans ces déplacements. Cela peut lui permettre de sauter plus haut ou plus loin, ou encore d’effectuer des mouvements spécifiques en jouant sur le timing du deuxième saut.
Modifier un symbole
Section intitulée « Modifier un symbole »config.js // player'#': () => [jumpController({ doubleJump: 1 }),sprite('bean'),platformerController(),jumpController(),sleep(),alive(),opacity(),scale(),health(1, 4),area(),body(),respawn(),falling(),rotate(),pos(0, -20),anchor('center'),'player',],Lancer une animation
Section intitulée « Lancer une animation »events.js function events() {return {add() {// double sauton('double jump', 'player', (obj, p) => {play('wooosh');tween(360 * -p.facing,0,0.3,(v) => (obj.angle = v),easings.easeOutSine);obj.play('jump', {speed: 4,onEnd: () => obj.play('idle'),});});// personnageson('respawn', 'alive', (obj) => (obj.flipY = false));on('hurt', 'alive', (obj) => {play('hit');colorShiftFx(obj, { color: 'ff9b9b' });});on('death', 'alive', (obj) => {obj.flipY = true;wait(0.2, () => {if (!obj.isAlive) {obj.hidden = true;obj.collisionIgnore = ['*'];obj.isStatic = true;}});});// joueuron('respawn', 'player', (obj) => obj.play('idle'));on('sleep', 'player', (obj) => obj.play('sleep'));on('awake', 'player', (obj) => obj.play('idle'));on('jump', 'player', (obj) => {play('wooosh');obj.play('jump', {speed: 4,onEnd: () => obj.play('idle'),});});on('drop', 'player', (obj) => {play('off');obj.play('worry');});on('hurt', 'player', (obj) => {obj.play('worry', {speed: 2,onEnd: () => obj.play('idle'),});});},};}
Paramètres
Section intitulée « Paramètres »platformerController()
exampleconfig.js
platformerController({ leftKey: 'left', rightKey: 'right', moveSpeed: 480, glideDelay: 0.1, moveReductionDelay: 0.1}),