Half changes to switch to exit level, Ran out of credits, re added enemies

This commit is contained in:
2026-01-31 14:56:53 +11:00
parent f6fc057e4f
commit 4b50e341a7
21 changed files with 762 additions and 747 deletions

View File

@@ -148,7 +148,7 @@ export class DungeonRenderer {
const spriteData = this.ecsWorld.getComponent(entId, "sprite");
if (pos && spriteData) {
try {
const isStandalone = spriteData.texture === "mine_cart" || spriteData.texture === "ceramic_dragon_head";
const isStandalone = spriteData.texture === "mine_cart" || spriteData.texture === "ceramic_dragon_head" || spriteData.texture === "track_switch";
const sprite = this.scene.add.sprite(
pos.x * TILE_SIZE + TILE_SIZE / 2,
pos.y * TILE_SIZE + TILE_SIZE / 2,

View File

@@ -142,7 +142,7 @@ describe('DungeonRenderer', () => {
killTweensOf: vi.fn(),
},
time: {
now: 0
now: 0
}
};
@@ -152,6 +152,7 @@ describe('DungeonRenderer', () => {
height: 10,
tiles: new Array(100).fill(0),
exit: { x: 9, y: 9 },
trackPath: []
};
ecsWorld = new ECSWorld();
accessor = new EntityAccessor(mockWorld, 1 as EntityId, ecsWorld);
@@ -186,7 +187,7 @@ describe('DungeonRenderer', () => {
it('should render exp_orb correctly', () => {
renderer.initializeFloor(mockWorld, ecsWorld, accessor);
// Add an exp_orb to the ECS world
ecsWorld.addComponent(2 as EntityId, "position", { x: 2, y: 1 });
ecsWorld.addComponent(2 as EntityId, "collectible", { type: "exp_orb", amount: 10 });
@@ -206,7 +207,7 @@ describe('DungeonRenderer', () => {
it('should render any enemy type as a sprite', () => {
renderer.initializeFloor(mockWorld, ecsWorld, accessor);
// Add a rat
ecsWorld.addComponent(3 as EntityId, "position", { x: 3, y: 1 });
ecsWorld.addComponent(3 as EntityId, "actorType", { type: "rat" });
@@ -224,7 +225,7 @@ describe('DungeonRenderer', () => {
it('should initialize new enemy sprites at target position and not tween them', () => {
renderer.initializeFloor(mockWorld, ecsWorld, accessor);
// Position 5,5 -> 5*16 + 8 = 88
const TILE_SIZE = 16;
const targetX = 5 * TILE_SIZE + TILE_SIZE / 2;
@@ -242,7 +243,7 @@ describe('DungeonRenderer', () => {
// Check spawn position
expect(mockScene.add.sprite).toHaveBeenCalledWith(targetX, targetY, 'rat', 0);
// Should NOT tween because it's the first spawn
expect(mockScene.tweens.add).not.toHaveBeenCalled();
});