Bloc évanescent
Fanny
Les blocs évanescents n’aparaissent que lorsqu’un personnage s’en rapproche.
Charger une image
Section intitulée « Charger une image »load.js const PNG = ['invisible','grass',];Déclarer un objet
Section intitulée « Déclarer un objet »config.js const TILE_CONFIG = {// text'*': () => [sprite('invisible'),area(),body({ isStatic: true }),offscreen(),vanishing(),sight({sight: 260,liveUpdate: true,offset: vec2(32, 32),}),opacity(),],// 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 }),],};Placer les objets
Section intitulée « Placer les objets »level.js const LEVELS = [{map: `***********#*****`,},]
Paramètres
Section intitulée « Paramètres »vanishing()
exampleconfig.js
vanishing({ tag: 'player', delay: 0.2, on: true}),sight()
exampleconfig.js
sight({ sight: 180, looseSight: 340, raycast: false, tag: 'player', rayCastExclude: ['pass through'], offset: vec2(0, 0), on: true, offScreenPaused: false, liveUpdate: false, onAddOnly: false}),