@waica/archetype-third-person 0.29.0 → 0.29.1

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
@@ -22,12 +22,13 @@ npx @waica/cli # New project → 3D → Third person
22
22
  - **Combat.** `MeleeAttack` strikes a box in front of the Knight's yaw;
23
23
  skeletons (the `enemy` role) patrol, chase, wind up, strike, flinch and
24
24
  die. Hits push back, blink the model and shake the camera.
25
- - **Checkpoints.** Touch a banner to make it your respawn point; dying fades
26
- out and back in there with full health.
25
+ - **Checkpoints.** Touch a banner hung on a wall to make it your respawn
26
+ point; dying fades out and back in on the floor in front of it with full
27
+ health (the Checkpoint's `spawnOffset`).
27
28
  - **The demo.** A walled courtyard with columns, wall torches (Point
28
- Lights), three skeletons, two checkpoints and the goal chest on a raised
29
- platform: reach it to win. The blank start is a ground plane, a Sun and
30
- the playable Knight.
29
+ Lights), three skeletons, two checkpoint banners on the side walls and the
30
+ goal chest on a raised platform: reach it to win. The blank start is a
31
+ ground plane, a Sun and the playable Knight.
31
32
 
32
33
  ## Controls
33
34
 
package/dist/prefabs.d.ts CHANGED
@@ -3,9 +3,16 @@ import type { PrefabJson } from '@waica/engine';
3
3
  export declare const KNIGHT_CLIPS: Readonly<Record<string, string>>;
4
4
  /** The Skeleton Warrior's clip for each `enemy` state (assets/ATTRIBUTION.md). */
5
5
  export declare const SKELETON_CLIPS: Readonly<Record<string, string>>;
6
+ /**
7
+ * How deep a checkpoint banner's origin sits inside the wall it hangs on: the
8
+ * banner is modelled to hang on a wall, its cloth's back 0.378 in front of
9
+ * its origin, so at this inset the cloth lies flush on the wall's inner face.
10
+ * The scene places the origin by it and the prefab its sensor and spawn.
11
+ */
12
+ export declare const BANNER_INSET = 0.35;
6
13
  /**
7
14
  * The archetype's prefabs (issue #181 CA-25): the Knight and the Skeleton
8
- * Warrior, a checkpoint and the goal chest (sensors), and the level pieces —
15
+ * Warrior, a checkpoint (a wall banner) and the goal chest (sensors), and the level pieces —
9
16
  * each a KayKit Dungeon Remastered model on a fixed Collider sized to it, the
10
17
  * torch with a warm Point Light. A step is the foundation block scaled flat.
11
18
  */
package/dist/prefabs.js CHANGED
@@ -74,9 +74,22 @@ const SKELETON = {
74
74
  { type: 'Health', props: { max: 3, invulnerability: 0.3, healthBar: 'health-bar', damageNumber: 'damage-number' } },
75
75
  ],
76
76
  };
77
+ /**
78
+ * How deep a checkpoint banner's origin sits inside the wall it hangs on: the
79
+ * banner is modelled to hang on a wall, its cloth's back 0.378 in front of
80
+ * its origin, so at this inset the cloth lies flush on the wall's inner face.
81
+ * The scene places the origin by it and the prefab its sensor and spawn.
82
+ */
83
+ export const BANNER_INSET = 0.35;
84
+ /**
85
+ * How far in front of a checkpoint banner's origin its 2-deep sensor and its
86
+ * spawn sit: the sensor starts at the wall's inner face and the Knight
87
+ * respawns 1 from it.
88
+ */
89
+ const CHECKPOINT_REACH = BANNER_INSET + 1;
77
90
  /**
78
91
  * The archetype's prefabs (issue #181 CA-25): the Knight and the Skeleton
79
- * Warrior, a checkpoint and the goal chest (sensors), and the level pieces —
92
+ * Warrior, a checkpoint (a wall banner) and the goal chest (sensors), and the level pieces —
80
93
  * each a KayKit Dungeon Remastered model on a fixed Collider sized to it, the
81
94
  * torch with a warm Point Light. A step is the foundation block scaled flat.
82
95
  */
@@ -88,8 +101,9 @@ export const THIRD_PERSON_PREFABS = {
88
101
  type: 'object',
89
102
  components: [
90
103
  { type: 'Model', props: { src: 'waica:tp-banner' } },
91
- { type: 'Collider', props: { shape: 'box', size: [2, 3, 2], offset: [0, 1.5, 0], sensor: true, layer: 'world' } },
92
- { type: 'Checkpoint' },
104
+ // A wall banner: its origin on the wall, its sensor and spawn on the floor in front of the wall (local +z).
105
+ { type: 'Collider', props: { shape: 'box', size: [2, 3, 2], offset: [0, 1.5, CHECKPOINT_REACH], sensor: true, layer: 'world' } },
106
+ { type: 'Checkpoint', props: { spawnOffset: [0, 0, CHECKPOINT_REACH] } },
93
107
  ],
94
108
  },
95
109
  'objects/goal-chest': {
@@ -1,3 +1,4 @@
1
+ import { BANNER_INSET } from './prefabs.js';
1
2
  /**
2
3
  * The orbit camera every scene follows the Player with. `position`/`target`
3
4
  * frame the editor's first look: where the orbit starts behind a Player at
@@ -32,6 +33,12 @@ const TILE_CENTERS = [-8, -4, 0, 4, 8];
32
33
  function floorTiles() {
33
34
  return TILE_CENTERS.flatMap((x) => TILE_CENTERS.map((z) => ({ name: `Floor ${x} ${z}`, prefab: 'tiles/floor', position: [x, 0, z] })));
34
35
  }
36
+ /**
37
+ * Where a checkpoint's wall banner hangs from the yard's centre: BANNER_INSET
38
+ * inside a wall whose inner face is HALF - 0.5 away (the wall pieces are 1
39
+ * thick), so its cloth lies flush on it.
40
+ */
41
+ const BANNER_AT = HALF - 0.5 + BANNER_INSET;
35
42
  /** The four sides of wall pieces, each turned to face the yard. */
36
43
  function walls() {
37
44
  return TILE_CENTERS.flatMap((at) => [
@@ -71,8 +78,9 @@ export const THIRD_PERSON_SCENE = threeDScene([
71
78
  { name: 'Torch NE', prefab: 'tiles/torch', position: [4, 2.5, -9.5] },
72
79
  { name: 'Torch SW', prefab: 'tiles/torch', position: [-4, 2.5, 9.5], rotation: [0, 180, 0] },
73
80
  { name: 'Torch SE', prefab: 'tiles/torch', position: [4, 2.5, 9.5], rotation: [0, 180, 0] },
74
- { name: 'Checkpoint West', prefab: 'objects/checkpoint', position: [-7, 0, 6] },
75
- { name: 'Checkpoint East', prefab: 'objects/checkpoint', position: [8, 0, 3] },
81
+ // Each banner hangs centred on a side wall's z 4 piece, turned like that wall to face the yard.
82
+ { name: 'Checkpoint West', prefab: 'objects/checkpoint', position: [-BANNER_AT, 0, 4], rotation: [0, 90, 0] },
83
+ { name: 'Checkpoint East', prefab: 'objects/checkpoint', position: [BANNER_AT, 0, 4], rotation: [0, -90, 0] },
76
84
  { name: 'Goal Chest', prefab: 'objects/goal-chest', position: [6, 0.5, -6] },
77
85
  ...SKELETONS,
78
86
  { name: 'Player', prefab: 'characters/player', position: [0, 0, 3.5] },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waica/archetype-third-person",
3
- "version": "0.29.0",
3
+ "version": "0.29.1",
4
4
  "description": "Waica third-person archetype — an orbit camera, camera-relative controls and 3D melee combat in a dungeon courtyard",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  }
25
25
  },
26
26
  "dependencies": {
27
- "@waica/behaviors": "^0.29.0",
28
- "@waica/engine": "^0.29.0"
27
+ "@waica/behaviors": "^0.29.1",
28
+ "@waica/engine": "^0.29.1"
29
29
  }
30
30
  }