Split overworldscene.js's player/plane/camera into their own classes

Extracts Player (extends Entity), TestPlane, and PlayerCamera into
their own files; the camera now tracks the player's live position
at a fixed offset instead of orbiting the world origin over time.
Updates test_overworldscene.c to match the new entity order and to
build an in-memory zip fixture, since overworldscene.js now
require()s these sibling files and require() always resolves
through ASSET.zip.
This commit is contained in:
2026-08-03 19:35:54 -05:00
parent 06bc4fcd55
commit b9d2fe60fd
5 changed files with 234 additions and 139 deletions
+6 -8
View File
@@ -3,23 +3,21 @@
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
// Player: dynamic capsule body, moved relative to the camera by PLAYER's
// own update callback (see entityplayer.c).
class Player {
class Player extends Entity {
constructor() {
this.entity = new Entity();
super();
this.position = this.entity.add(POSITION);
this.position = this.add(POSITION);
this.position.setLocalPosition(0.0, 2.0, 0.0);
this.physics = this.entity.add(PHYSICS);
this.physics = this.add(PHYSICS);
this.physics.setShape(PHYSICS_SHAPE_CAPSULE, 0.5, 0.5);
this.renderable = this.entity.add(RENDERABLE);
this.renderable = this.add(RENDERABLE);
this.renderable.setMesh(0, MESH_CAPSULE);
this.renderable.setColor(0, 0, 255, 255);
this.entity.add(PLAYER);
this.add(PLAYER);
}
}