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 = {// block'-': () => [sprite('small-grass'),area(),body({ isStatic: true }),anchor('top'),offscreen({ hide: true }),pos(32, 0),'pass through',],// player'#': () => [sprite('bean'),platformerController(),jumpController(),sleep(),alive(),opacity(),scale(),health(1, 4),area(),body(),respawn(),falling(),rotate(),pos(0, -20),anchor('center'),'player',],// block'=': () => [sprite('grass-tileset'),offscreen({ hide: true }),tile({ isObstacle: true }),autoTiling(),area(),body({ isStatic: true }),],};modifier le joueur
Section intitulée « modifier le joueur »config.js // player'#': () => [passThroughController(),sprite('bean'),platformerController(),jumpController(),sleep(),alive(),opacity(),scale(),health(1, 4),area(),body(),respawn(),falling(),rotate(),pos(0, -20),anchor('center'),'player',],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'}),