create-exo-app 0.19.1 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,17 +19,19 @@ Only ExoJS packages move together. Vite, TypeScript and the rest of the build to
19
19
 
20
20
  ## Templates
21
21
 
22
- | Template | Starting point |
23
- | ---------------- | ------------------------------------------------------------------------------ |
24
- | `minimal` | One visible animated object in one scene. |
25
- | `game-starter` | Keyboard-controlled gameplay and a game-over scene. |
26
- | `platformer` | Side-scrolling physics, camera follow, and jump handling. |
27
- | `top-down` | Tilemaps, collision, and click-to-move pathfinding; procedural or Tiled input. |
28
- | `ui-app` | A settings interface built from Core UI widgets. |
29
- | `audio-reactive` | Shapes driven by live audio analysis. |
22
+ | Template | Starting point |
23
+ | ---------------- | ------------------------------------------------------------------------------- |
24
+ | `minimal` | One visible animated object in one scene. |
25
+ | `game-starter` | Keyboard-controlled gameplay and a game-over scene. |
26
+ | `platformer` | Side-scrolling physics, camera follow, and jump handling. |
27
+ | `top-down` | A Tiled map whose walls and door drive collision and click-to-move pathfinding. |
28
+ | `ui-app` | A settings interface built from Core UI widgets. |
29
+ | `audio-reactive` | Shapes driven by live audio analysis. |
30
30
 
31
31
  Availability follows the scaffolder version you run. The repository's `next` branch can contain a template that is not yet in an older npm release. A specialized template includes more systems; it is not a prerequisite for using the engine.
32
32
 
33
+ The [sprite and animation recipe](https://exoridus.github.io/ExoJS/en/guide/rendering/animation/#a-complete-sprite-and-animation-scene) is a small asset-backed next step after `minimal`. The [preload and scene-switch recipe](https://exoridus.github.io/ExoJS/en/guide/assets/migrating-to-model-b-plus/#a-complete-preload-and-scene-switch-workflow) separates data preparation, activation, browser audio unlock, and cleanup without another manager layer.
34
+
33
35
  ## Locate the application code
34
36
 
35
37
  `src/main.ts` creates the application, registers scene classes, mounts the canvas, and awaits startup. Scene behavior lives in `src/scenes/`. Files under `public/assets/` are served unchanged; `public/` is not part of their request URL.
package/dist/scaffold.js CHANGED
@@ -17,24 +17,20 @@ export const TEMPLATE_DESCRIPTIONS = {
17
17
  minimal: 'smallest TypeScript ExoJS app with one Scene and one visible object',
18
18
  'game-starter': 'keyboard-controlled game loop starter with Scene structure',
19
19
  platformer: 'side-scroller with physics bodies, camera follow and a forgiving jump',
20
- 'top-down': 'tilemap, physics and click-to-move pathfinding, procedural or from Tiled',
20
+ 'top-down': 'a Tiled map whose walls and doors drive physics and click-to-move pathfinding',
21
21
  'ui-app': 'settings screen built from the UI widgets in core',
22
22
  'audio-reactive': 'AudioAnalyser-driven shapes and animations',
23
23
  };
24
24
  /** Absolute path of a template's source directory inside this package. */
25
25
  export const templateDirectory = (template) => join(__dirname, '..', 'templates', template);
26
- const isInteractive = () => {
27
- return process.stdin.isTTY === true;
28
- };
29
- const prompt = (question) => {
30
- return new Promise(resolve => {
31
- const rl = createInterface({ input: process.stdin, output: process.stdout });
32
- rl.question(question, answer => {
33
- rl.close();
34
- resolve(answer.trim());
35
- });
26
+ const isInteractive = () => process.stdin.isTTY === true;
27
+ const prompt = (question) => new Promise(resolve => {
28
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
29
+ rl.question(question, answer => {
30
+ rl.close();
31
+ resolve(answer.trim());
36
32
  });
37
- };
33
+ });
38
34
  const promptProjectName = async () => {
39
35
  const answer = await prompt('Project name: ');
40
36
  if (!answer) {
@@ -63,13 +59,16 @@ const pinEngineDependencies = (manifest) => {
63
59
  const range = engineRange();
64
60
  for (const bucket of ['dependencies', 'devDependencies']) {
65
61
  const deps = manifest[bucket];
66
- if (typeof deps !== 'object' || deps === null)
62
+ if (typeof deps !== 'object' || deps === null) {
67
63
  continue;
64
+ }
68
65
  for (const [name, value] of Object.entries(deps)) {
69
- if (!name.startsWith('@codexo/'))
66
+ if (!name.startsWith('@codexo/')) {
70
67
  continue;
71
- if (typeof value !== 'string')
68
+ }
69
+ if (typeof value !== 'string') {
72
70
  continue;
71
+ }
73
72
  deps[name] = range;
74
73
  }
75
74
  }
@@ -81,15 +80,18 @@ const promptTemplate = async () => {
81
80
  console.log(` ${marker} ${(i + 1).toString()}) ${t.padEnd(16)} — ${TEMPLATE_DESCRIPTIONS[t]}`);
82
81
  });
83
82
  const answer = await prompt('\nEnter number or name [1]: ');
84
- if (!answer || answer === '1')
83
+ if (!answer || answer === '1') {
85
84
  return 'minimal';
85
+ }
86
86
  const num = parseInt(answer, 10);
87
87
  const byNumber = Number.isNaN(num) ? undefined : TEMPLATES[num - 1];
88
- if (byNumber)
88
+ if (byNumber) {
89
89
  return byNumber;
90
+ }
90
91
  const matched = TEMPLATES.find(t => t === answer);
91
- if (matched)
92
+ if (matched) {
92
93
  return matched;
94
+ }
93
95
  console.error(`Unknown template: "${answer}". Using "minimal".`);
94
96
  return 'minimal';
95
97
  };
@@ -131,7 +133,7 @@ export const scaffoldApp = (options) => {
131
133
  const pkgJson = JSON.parse(pkgContent);
132
134
  pkgJson.name = basename(projectName);
133
135
  pinEngineDependencies(pkgJson);
134
- writeFileSync(pkgPath, JSON.stringify(pkgJson, null, 2) + '\n');
136
+ writeFileSync(pkgPath, `${JSON.stringify(pkgJson, null, 2)}\n`);
135
137
  return destDir;
136
138
  };
137
139
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-exo-app",
3
- "version": "0.19.1",
3
+ "version": "0.20.0",
4
4
  "description": "Official starter for ExoJS — scaffold a new app with npm create exo-app",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -11,8 +11,7 @@
11
11
  "preview": "vite preview"
12
12
  },
13
13
  "dependencies": {
14
- "@codexo/exojs": "lockstep",
15
- "@codexo/exojs-audio-fx": "lockstep"
14
+ "@codexo/exojs": "lockstep"
16
15
  },
17
16
  "devDependencies": {
18
17
  "typescript": "^7.0.2",
@@ -1,6 +1,6 @@
1
1
  import type { RenderingContext } from '@codexo/exojs';
2
2
  import { Color, getAudioContext, Graphics, Scene, Text } from '@codexo/exojs';
3
- import { AudioAnalyser } from '@codexo/exojs-audio-fx';
3
+ import { AudioAnalyser } from '@codexo/exojs/audio-fx';
4
4
 
5
5
  const BAR_COUNT = 32;
6
6
 
@@ -28,7 +28,10 @@ export class AudioReactiveScene extends Scene {
28
28
  this.addChild(this._bars);
29
29
 
30
30
  const onTap = (): void => {
31
- if (this._started) return;
31
+ if (this._started) {
32
+ return;
33
+ }
34
+
32
35
  this._started = true;
33
36
  this._prompt.visible = false;
34
37
 
@@ -14,7 +14,11 @@ export class GameOverScene extends Scene<GameOverData> {
14
14
 
15
15
  this.app!.clearColor.set(48, 10, 10);
16
16
 
17
- this._label = new Text(`Game Over\nScore: ${data.score}\n\nPress Space to restart`, { align: 'center', fillColor: Color.white, fontSize: 26 });
17
+ this._label = new Text(`Game Over\nScore: ${data.score}\n\nPress Space to restart`, {
18
+ align: 'center',
19
+ fillColor: Color.white,
20
+ fontSize: 26,
21
+ });
18
22
  this._label.setAnchor(0.5);
19
23
  this._label.setPosition(width / 2, height / 2);
20
24
 
@@ -1,6 +1,6 @@
1
1
  # Platformer template
2
2
 
3
- Side-scrolling starter wired to `@codexo/exojs-physics`: a dynamic player body, static level geometry, camera follow, and the two timing rules that make a jump feel right.
3
+ Side-scrolling starter wired to `@codexo/exojs/physics`: a dynamic player body, static level geometry, camera follow, and the two timing rules that make a jump feel right.
4
4
 
5
5
  ## Where things are
6
6
 
@@ -8,6 +8,16 @@ Side-scrolling starter wired to `@codexo/exojs-physics`: a dynamic player body,
8
8
  - `src/objects/Player.ts` — movement, jumping, and the ground check.
9
9
  - `public/assets/` — the sprite atlases.
10
10
 
11
+ ## Timing
12
+
13
+ The physics world is a scene system built with `fixedDelta: this.app.fixedTimeStep`, so the application's fixed step drives it and it stays correct if you change `fixedTimeStep`. The player is advanced from the scene's `fixedUpdate`, right before the world steps, so a jump reaches the same height whatever the display's refresh rate.
14
+
15
+ Controls are an `ActionMap`: running reads the held `move` axis, and jumping reads `controls.jump.tick.pressed`, which hands each press to exactly one fixed step even when a frame runs no step or several. The player body never sleeps, because a sleeping body ignores velocity written onto it.
16
+
17
+ ## Choosing a character controller
18
+
19
+ This starter deliberately uses a dynamic body, ground ray, and direct frame selection. For a kinematic motor with grounded state, slopes, steps, and named Idle/Walk/Jump clips, follow the [complete character recipe](https://exoridus.github.io/ExoJS/en/guide/physics/character-movement/#idle-walk-and-jump-in-one-scene). Both use one scene-owned PhysicsWorld and fixed-step input; choose the movement authority your game needs. The [camera and parallax recipe](https://exoridus.github.io/ExoJS/en/guide/recipes/camera-follow-and-parallax/) explains world targets, smoothing, and screen-to-world picking.
20
+
11
21
  ## Art
12
22
 
13
23
  The sprite atlases are from Kenney's _New Platformer Pack_, released under CC0. `public/assets/ART-LICENSE.txt` is the pack's own licence file. You can replace or delete the art without any attribution obligation.
@@ -11,8 +11,7 @@
11
11
  "preview": "vite preview"
12
12
  },
13
13
  "dependencies": {
14
- "@codexo/exojs": "lockstep",
15
- "@codexo/exojs-physics": "lockstep"
14
+ "@codexo/exojs": "lockstep"
16
15
  },
17
16
  "devDependencies": {
18
17
  "typescript": "^7.0.2",
@@ -1,7 +1,7 @@
1
1
  import type { Seconds, Spritesheet } from '@codexo/exojs';
2
- import { Sprite } from '@codexo/exojs';
3
- import type { PhysicsBody, PhysicsWorld } from '@codexo/exojs-physics';
4
- import { BoxShape } from '@codexo/exojs-physics';
2
+ import { type Sprite } from '@codexo/exojs';
3
+ import type { PhysicsBody, PhysicsWorld } from '@codexo/exojs/physics';
4
+ import { BoxShape } from '@codexo/exojs/physics';
5
5
 
6
6
  const WIDTH = 56;
7
7
  const HEIGHT = 84;
@@ -24,14 +24,18 @@ const COYOTE_TIME = 0.1 as Seconds;
24
24
  */
25
25
  const JUMP_BUFFER = 0.12 as Seconds;
26
26
 
27
- /** Multiplier applied to upward velocity when jump is released early, for a variable-height jump. */
27
+ /**
28
+ * Share of its upward velocity a rising player keeps per 1/60 s once jump is
29
+ * released, for a variable-height jump. Scaled by the step length, so the arc
30
+ * is the same at any fixed-step rate.
31
+ */
28
32
  const JUMP_CUT = 0.45;
29
33
 
30
34
  export interface PlayerInput {
31
- readonly left: boolean;
32
- readonly right: boolean;
35
+ /** Horizontal direction, -1 (left) to 1 (right); only its sign is used. */
36
+ readonly move: number;
33
37
  readonly jumpHeld: boolean;
34
- /** True only on the frame the jump key went down. */
38
+ /** True only in the fixed step a jump press was delivered to. */
35
39
  readonly jumpPressed: boolean;
36
40
  }
37
41
 
@@ -70,6 +74,9 @@ export class Player {
70
74
  friction: 0,
71
75
  restitution: 0,
72
76
  });
77
+ // A sleeping body ignores velocity written onto it, and a player standing
78
+ // still falls asleep within a second; the next run or jump would do nothing.
79
+ this.body.allowSleep = false;
73
80
  }
74
81
 
75
82
  public get grounded(): boolean {
@@ -81,8 +88,12 @@ export class Player {
81
88
  return this._world.rayCast(origin, { x: 0, y: 1 }, undefined, 8) !== null;
82
89
  }
83
90
 
84
- public update(delta: Seconds, input: PlayerInput): void {
85
- const grounded = this.grounded;
91
+ /** Advances the player by one fixed step, before the world integrates it. */
92
+ public fixedUpdate(delta: Seconds, input: PlayerInput): void {
93
+ // Rising is never standing: at a fast fixed step the first step of a jump
94
+ // can still end within the ground ray's reach, and re-arming coyote time
95
+ // there would allow a second jump in mid-air.
96
+ const grounded = this.body.linearVelocityY >= -1 && this.grounded;
86
97
 
87
98
  this._coyote = grounded ? COYOTE_TIME : (Math.max(0, this._coyote - delta) as Seconds);
88
99
  this._buffered = input.jumpPressed ? JUMP_BUFFER : (Math.max(0, this._buffered - delta) as Seconds);
@@ -98,7 +109,7 @@ export class Player {
98
109
 
99
110
  // Releasing jump while still rising cuts the arc short.
100
111
  if (!input.jumpHeld && this.body.linearVelocityY < 0) {
101
- this.body.linearVelocityY *= JUMP_CUT;
112
+ this.body.linearVelocityY *= JUMP_CUT ** (delta * 60);
102
113
  }
103
114
 
104
115
  this._updateFrame(grounded);
@@ -113,7 +124,7 @@ export class Player {
113
124
  }
114
125
 
115
126
  private _applyHorizontal(delta: Seconds, input: PlayerInput): void {
116
- const direction = (input.right ? 1 : 0) - (input.left ? 1 : 0);
127
+ const direction = Math.sign(input.move);
117
128
  const velocity = this.body.linearVelocityX;
118
129
 
119
130
  if (direction === 0) {
@@ -1,6 +1,20 @@
1
1
  import type { RenderingContext, Seconds, SpritesheetData } from '@codexo/exojs';
2
- import { Asset, Container, Keyboard, Label, Rectangle, Scene, Spritesheet, SystemOrder, View } from '@codexo/exojs';
3
- import { BoxShape, PhysicsBody, PhysicsWorld } from '@codexo/exojs-physics';
2
+ import {
3
+ ActionMap,
4
+ AxisAction,
5
+ ButtonAction,
6
+ Container,
7
+ Keyboard,
8
+ Label,
9
+ Rectangle,
10
+ Scene,
11
+ Sprite,
12
+ Spritesheet,
13
+ SystemOrder,
14
+ Texture,
15
+ View,
16
+ } from '@codexo/exojs';
17
+ import { BoxShape, PhysicsBody, PhysicsWorld } from '@codexo/exojs/physics';
4
18
 
5
19
  import { Player } from '../objects/Player';
6
20
 
@@ -69,35 +83,49 @@ const findMarker = (level: readonly string[], marker: string): { x: number; y: n
69
83
  };
70
84
 
71
85
  export class PlatformerScene extends Scene {
72
- private readonly _world = new PhysicsWorld({ gravity: { x: 0, y: 2400 } });
86
+ /** The ActionMap the scene reads: a horizontal axis to run, a button to jump. */
87
+ public readonly controls = new ActionMap({
88
+ move: new AxisAction([
89
+ { negative: Keyboard.A, positive: Keyboard.D },
90
+ { negative: Keyboard.Left, positive: Keyboard.Right },
91
+ ]),
92
+ jump: new ButtonAction([Keyboard.Space, Keyboard.W, Keyboard.Up]),
93
+ });
94
+
73
95
  private readonly _level = new Container();
74
- private readonly _held = { left: false, right: false, jump: false };
96
+ private _world!: PhysicsWorld;
75
97
  private _camera!: View;
76
98
  private _player!: Player;
77
99
  private _status!: Label;
78
100
  private _spawn = { x: 0, y: 0 };
79
101
  private _goal = { x: 0, y: 0 };
80
- private _jumpPressed = false;
81
102
  private _tiles!: Spritesheet;
82
103
  private _characters!: Spritesheet;
83
104
  private _tileData!: SpritesheetData;
84
105
  private _characterData!: SpritesheetData;
106
+ private readonly _tilesTexture = new Texture('platformer-tiles.png');
107
+ private readonly _charactersTexture = new Texture('platformer-characters.png');
108
+
109
+ public get player(): Player {
110
+ return this._player;
111
+ }
85
112
 
86
113
  public override async load(): Promise<void> {
87
- this._tileData = (await this.loader.load(Asset.type('json', 'platformer-tiles.json'))) as SpritesheetData;
88
- this._characterData = (await this.loader.load(Asset.type('json', 'platformer-characters.json'))) as SpritesheetData;
114
+ this._tileData = (await this.loader.load({ type: 'json', source: 'platformer-tiles.json' })) as SpritesheetData;
115
+ this._characterData = (await this.loader.load({ type: 'json', source: 'platformer-characters.json' })) as SpritesheetData;
89
116
 
90
- await this.loader.load(Asset.type('texture', 'platformer-tiles.png'));
91
- await this.loader.load(Asset.type('texture', 'platformer-characters.png'));
117
+ await this.assets.load([this._tilesTexture, this._charactersTexture]);
92
118
  }
93
119
 
94
120
  public override init(): void {
95
- this._tiles = new Spritesheet(this.loader.get('platformer-tiles.png'), this._tileData);
96
- this._characters = new Spritesheet(this.loader.get('platformer-characters.png'), this._characterData);
121
+ this._tiles = new Spritesheet(this._tilesTexture, this._tileData);
122
+ this._characters = new Spritesheet(this._charactersTexture, this._characterData);
97
123
 
98
124
  // Registering the world as a system hands it to the engine's fixed-timestep
99
- // scheduler. Nothing here calls `step()`; after every fixed step the world
100
- // writes each body's transform onto the node bound to it.
125
+ // scheduler, which steps it right after this scene's own fixedUpdate(). A
126
+ // hosted world has to step at the host's rate, so it takes the application's
127
+ // fixed step rather than its own default. Nothing here calls `step()`.
128
+ this._world = new PhysicsWorld({ gravity: { x: 0, y: 2400 }, fixedDelta: this.app.fixedTimeStep });
101
129
  this.systems.add(this._world, { order: SystemOrder.Physics });
102
130
 
103
131
  this._spawn = findMarker(LEVEL, 'S');
@@ -114,25 +142,25 @@ export class PlatformerScene extends Scene {
114
142
  this._camera.follow(this._player.sprite, { lerp: 0.12 });
115
143
  this._camera.setBounds(new Rectangle(0, 0, LEVEL[0]!.length * TILE, LEVEL.length * TILE));
116
144
 
117
- this._bindInput();
145
+ this.inputs.attach(this.controls);
118
146
 
119
147
  this._status = new Label('Arrows or A/D to move, Space to jump.', { fontSize: 18 });
120
148
  this._status.anchorIn(this.ui, 'top-left', 24, 20);
121
149
  this.ui.addChild(this._status);
122
150
  }
123
151
 
124
- public override update(delta: Seconds): void {
125
- this._player.update(delta, {
126
- left: this._held.left,
127
- right: this._held.right,
128
- jumpHeld: this._held.jump,
129
- jumpPressed: this._jumpPressed,
152
+ // Gameplay runs on the fixed step, the clock the world steps on: velocity the
153
+ // player writes here is what the world integrates right after, once per step,
154
+ // however often the display refreshes. Held controls are read as values; the
155
+ // jump press through the action's `tick` view, which hands each press to
156
+ // exactly one step even when a frame runs none or several.
157
+ public override fixedUpdate(step: Seconds): void {
158
+ this._player.fixedUpdate(step, {
159
+ move: this.controls.move.value,
160
+ jumpHeld: this.controls.jump.active,
161
+ jumpPressed: this.controls.jump.tick.pressed,
130
162
  });
131
163
 
132
- // The press is an edge, not a state: consuming it here is what keeps one
133
- // key-down from arming a jump on every following frame.
134
- this._jumpPressed = false;
135
-
136
164
  const reached = Math.hypot(this._player.body.x - this._goal.x, this._player.body.y - this._goal.y) < TILE;
137
165
  const fell = this._player.body.y > LEVEL.length * TILE + 400;
138
166
 
@@ -156,7 +184,7 @@ export class PlatformerScene extends Scene {
156
184
  // solver sees a single flat surface. A body per tile would give the player
157
185
  // a seam to catch on at every tile boundary.
158
186
  for (let i = 0; i < run.length; i++) {
159
- const tile = this._tiles.getFrameSprite(this._tileName(run, i)).setAnchor(0.5);
187
+ const tile = new Sprite(this._tiles.texture).setTextureFrame(this._tiles.getFrame(this._tileName(run, i))).setAnchor(0.5);
160
188
 
161
189
  tile.width = TILE;
162
190
  tile.height = TILE;
@@ -205,33 +233,4 @@ export class PlatformerScene extends Scene {
205
233
  flag.setPosition(this._goal.x, this._goal.y);
206
234
  this._level.addChild(flag);
207
235
  }
208
-
209
- private _bindInput(): void {
210
- const bindHold = (key: Keyboard, set: (down: boolean) => void): void => {
211
- this.inputs.onActive(key, () => set(true));
212
- this.inputs.onStop(key, () => set(false));
213
- };
214
-
215
- for (const key of [Keyboard.A, Keyboard.Left]) {
216
- bindHold(key, down => {
217
- this._held.left = down;
218
- });
219
- }
220
-
221
- for (const key of [Keyboard.D, Keyboard.Right]) {
222
- bindHold(key, down => {
223
- this._held.right = down;
224
- });
225
- }
226
-
227
- for (const key of [Keyboard.Space, Keyboard.W, Keyboard.Up]) {
228
- bindHold(key, down => {
229
- this._held.jump = down;
230
-
231
- if (down) {
232
- this._jumpPressed = true;
233
- }
234
- });
235
- }
236
- }
237
236
  }
@@ -1,26 +1,43 @@
1
1
  # Top-down template
2
2
 
3
- Tilemap, physics and click-to-move pathfinding, wired together. The same level is available two ways, so you can see what each map format costs you before committing to one.
3
+ A map that drives the game: the walls and the door you see are the walls and the door that block the player, both for its physics body and for its click-to-move pathfinding. The player walks by click or with WASD, and `E` opens and closes the door it stands next to.
4
4
 
5
5
  ## Two scenes, one level
6
6
 
7
- - `ProceduralMapScene` builds the map in code from `src/level.ts`. Right when the layout is decided at runtime.
8
- - `TiledMapScene` loads the same layout from `public/assets/town-square.tmj`. Right when a designer edits the level.
7
+ - `TiledMapScene` loads `public/assets/town-square.tmj`. Right when a designer edits the level in [Tiled](https://www.mapeditor.org/).
8
+ - `ProceduralMapScene` builds the same map in code from `src/level.ts`. Right when the layout is decided at runtime.
9
9
 
10
- `main.ts` starts the procedural one. Delete whichever you do not need — nothing else in the template depends on the choice.
10
+ `main.ts` starts the Tiled one. Delete whichever you do not need — nothing else depends on the choice.
11
11
 
12
- Both extend `TopDownScene`, which owns everything that does not vary: the physics world, the wall colliders, the navigation grid, the pathfinder, the camera and the HUD. That split is the point. Pathfinding and physics never read the tilemap; they read a grid of costs and a set of bodies. Swapping the map format changes what you look at and nothing about how the actor moves.
12
+ Both extend `TopDownScene`, which reads everything from the map it is given:
13
+
14
+ - **Walls.** A tile of the `Walls` layer whose tileset definition has a collision shape is solid. `TileColliderStreamer` (from `@codexo/exojs/tilemap-physics`) turns those shapes into static physics bodies; `TileNavigationSpace` (from `@codexo/exojs/pathfinding`) routes around the same cells. In Tiled, a tile's collision is drawn in the tileset's _Tile Collision Editor_.
15
+ - **Doors.** A `Walls` tile with a `door` property is a door. Opening it removes the tile, closing it puts it back; both the colliders and the routes follow the edit. A door does not close on any physics body that reaches into the doorway.
16
+ - **Spawn.** The `spawn` point of the `Markers` object layer.
17
+
18
+ The actor is a kinematic circle: `KinematicMovementComponent` moves it without passing through walls, and `NavigationAgentComponent` steers it along a route. `src/actor.ts` sizes the route to the actor, so an actor wider than a tile is kept out of one-tile gaps instead of planning a path its body cannot walk. A click walks the actor to the middle of the clicked tile (for a wide actor, the middle of the nearest free square of tiles it fits in) rather than to the exact pixel, because a spot beside a wall is one its body cannot reach. A click on a wall, or on a tile no route of the actor's width leads to, ends as unreachable.
19
+
20
+ ## When things update
21
+
22
+ Physics and navigation read the same layer but at different moments, and the scene is explicit about both:
23
+
24
+ - the collider bridge syncs before each frame's fixed steps, and again right after a door edit, so no physics step runs against a stale wall;
25
+ - the navigation space resamples when an agent next reads it. A walking agent notices a door edit and replans within its repath interval; until then the synced collider is what stops it at a door that just closed.
26
+
27
+ The door key is read from the action's `tick` view inside `fixedUpdate`, so one press toggles the door once however many fixed steps the frame runs. Clicks are ignored while the scene is paused or suspended, so nothing is queued for later.
13
28
 
14
29
  ## Editing the level
15
30
 
16
- `src/level.ts` is the source of truth for the procedural scene, the navigation grid and the wall colliders. `town-square.tmj` was generated from it, so changing one without the other makes the two scenes disagree.
31
+ `town-square.tmj` is the source of truth for `TiledMapScene`. `src/level.ts` describes the same layout for `ProceduralMapScene`; change one without the other and the two scenes disagree.
32
+
33
+ - **Tiled only** — edit the map; collision and navigation follow it with no code change.
34
+ - **both** — edit `LEVEL` in `src/level.ts` and redraw `town-square.tmj` to match, or drop `ProceduralMapScene`.
17
35
 
18
- To change the layout:
36
+ The `Walls` and door tiles are placeholders from the atlas. Pick tiles that suit your game, and give the solid ones a collision shape.
19
37
 
20
- - **procedural only** — edit `LEVEL` in `src/level.ts` and you are done;
21
- - **both** — edit `LEVEL`, then redraw `town-square.tmj` in [Tiled](https://www.mapeditor.org/) to match, or drop `TiledMapScene`.
38
+ ## Smaller recipes
22
39
 
23
- The map's `Walls` layer uses a placeholder tile from the atlas. Open the map in Tiled and pick something that suits your game — the layout is what the scene reads, not the tile id.
40
+ The [sprite movement recipe](https://exoridus.github.io/ExoJS/en/guide/physics/physics-basics/#a-sprite-with-collision-aware-movement) isolates the existing body/motor components without map loading. The [enemy sensor recipe](https://exoridus.github.io/ExoJS/en/guide/recipes/gameplay-collision/#enemies-and-physics-sensors) adds named filter bits, a single event dispatcher, and component-owned despawn.
24
41
 
25
42
  ## Art
26
43
 
@@ -12,10 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "@codexo/exojs": "lockstep",
15
- "@codexo/exojs-pathfinding": "lockstep",
16
- "@codexo/exojs-physics": "lockstep",
17
- "@codexo/exojs-tiled": "lockstep",
18
- "@codexo/exojs-tilemap": "lockstep"
15
+ "@codexo/exojs-tiled": "lockstep"
19
16
  },
20
17
  "devDependencies": {
21
18
  "typescript": "^7.0.2",