Bloc traversable
Sullivan
Charger une image
Section intitulée « Charger une image »load.js const PNG = ["small-grass","grass",]Déclarer un objet
Section intitulée « Déclarer un objet »config.js const TILE_CONFIG = {"-": () => [ // blocksprite("small-grass"),area(),body({ isStatic: true }),anchor("bot"),offscreen({ hide: true }),pos(0, -32),"pass through",],"#": () => [ // player 1sprite("bean"),platformerController(),jumpController(),sleep(),alive(),opacity(),scale(),health(1, 4),area(),body(),respawn(),falling(),rotate(),pos(0, -20),anchor("center"),],"=": () => [ // blocksprite("grass"),area({ collisionIgnore: ["agent"] }),body({ isStatic: true }),anchor("bot"),offscreen({ hide: true }),tile({ isObstacle: true }),],}modifier le joueur
Section intitulée « modifier le joueur »config.js "#": () => [ // player 1passThroughController(),sprite("bean"),platformerController(),jumpController(),sleep(),alive(),opacity(),scale(),health(1, 4),area(),body(),respawn(),falling(),rotate(),pos(0, -20),anchor("center"),],Placer les objets
Section intitulée « Placer les objets »level.js const LEVELS = [{map: `-----#=====`,},]
Paramètres
Section intitulée « Paramètres »passThroughController()
exampleconfig.js
passThroughController({ downKey: "down"}),