Les blocs traversables permettent de faciliter la circulation du joueur.
Charger une image
load.jsconst PNG = [ "small-grass", "grass", ]
Déclarer un symbole
levelConf.jsconst LEVEL_CONFIG = { // paramètres du niveau tileWidth: 64, tileHeight: 64, backgroundColor: "afe1ff", gravity: 3200, tiles: { // listes des objets à placer dans les niveaux
"-": () => [ // block sprite("small-grass"), area(), body({ isStatic: true }), anchor("bot"), offscreen({ hide: true }), pos(0,-32), "pass through", ],"#": () => [ // 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.jsconst LEVELS = [ // liste des niveaux du jeu { map: ` ----- # ===== `, }, ];