Configurer des niveaux
Fanny
Configuration pour l’ensemble des niveaux
Section intitulée « Configuration pour l’ensemble des niveaux »const LEVEL_CONFIG = {
// paramètres du niveau
tileWidth: 64, tileHeight: 64, backgroundColor: "afe1ff", gravity: 3200,
tiles: {
"#": () => [ // player 1 sprite("bean"), platformerController(), alive(), opacity(), scale(), health(1, 4), area(), anchor("bot"), body(), respawn(), falling(), ],
"=": () => [ // block sprite("grass"), area(), body({ isStatic: true }), anchor("bot"), offscreen({ hide: true }), ],
},}Configuration pour un niveau
Section intitulée « Configuration pour un niveau »const LEVELS = [
// niveau 0 { map: `
# ===========
`, config:{ tileWidth: 64, tileHeight: 64, backgroundColor: "afe1ff", gravity: 3200, tiles: { "=": () => [ // bloc sprite("grass"), area(), body({ isStatic: true }), anchor("bot"), offscreen({ hide: true }), ], }, } },
];