Bloc glissant
Les blocs qui glissent créent une inertie dans les déplacements du joueur et ajoutent un délai aux changements de directions qu’il opère. Ces blocs peuvent être utilisés pour bousculer les habitudes du joueur en rendant son personnage plus difficile à contrôler.
Charger une image
Section intitulée « Charger une image »load.js const PNG = ["icy","grass",]Déclarer un objet
Section intitulée « Déclarer un objet »config.js const LEVEL_CONFIG = {// paramètres du niveautileWidth: 64,tileHeight: 64,backgroundColor: "afe1ff",gravity: 3200,tiles: {"%": () => [ // bloc qui glissesprite("icy"),area(),body({ isStatic: true }),anchor("bot"),offscreen({ hide: true }),{ glide: 2 },],"#": () => [ // player 1sprite("bean"),platformerController(),alive(),opacity(),scale(),health(1, 4),area(),anchor("bot"),body(),respawn(),falling(),],"=": () => [ // blocksprite("grass"),area(),body({ isStatic: true }),anchor("bot"),offscreen({ hide: true }),],},}Placer les objets
Section intitulée « Placer les objets »level.js const LEVELS = [{map: `===%%%%%%%%%%%%%#===== %%%`,},]
Paramètres
Section intitulée « Paramètres »exampleconfig.js
{ glide : 2 },