Blocs amovibles

Les blocs dynamiques peuvent être déplacés par le joueur et ainsi l'assister dans ses déplacements si ce dernier les positionne judicieusement.

Charger une image

load.js
const PNG = [ "sand", "grass", ]

Déclarer un symbole

levelConf.js
const LEVEL_CONFIG = { // paramètres du niveau tileWidth: 64, tileHeight: 64, backgroundColor: "afe1ff", gravity: 3200, tiles: { // listes des objets à placer dans les niveaux
"s": () => [ // sable sprite("sand"), area(), body(), anchor("bot"), respawn(), falling(), opacity(), scale(), ],
"#": () => [ // player sprite("bean"), platformerController(), alive(), opacity(), scale(), health(1, 4), area(), anchor("bot"), body(), respawn(), falling(), coloring(), animator(), ], "=": () => [ // block sprite("grass"), area(), body({ isStatic: true }), anchor("bot"), offscreen({ hide: true }), ], }, }

Placer les objets

level.js
const LEVELS = [ // liste des niveaux du jeu { map: ` s === s === s s # ============ s === `, }, ];

body

body( { mass : 2 } ),

respawn

levelConf.js
tiles :
respawn({ live: false, appearAnimDuration: 0.4, }),