v0.02
This commit is contained in:
1 parent
234e769f4d
commit
e6a0aa94de
10 files changed
+872
-583
No files matched your search
+8
-5
@@ -203,7 +203,7 @@ export class Level {
|
||||
// 出生点
|
||||
const sp = this.entities.find(e => e.type === 'spawn');
|
||||
this.spawn = sp
|
||||
? { x: sp.x + sp.w / 2 - 7, y: sp.y + sp.h - 18 }
|
||||
? { x: sp.x + sp.w / 2 - 5.5, y: sp.y + sp.h - 21 }
|
||||
: (this.spawnExtra ? { x: this.spawnExtra[0] * TILE, y: this.spawnExtra[1] * TILE } : { x: 40, y: 40 });
|
||||
// 总苹果数 / 存档点数
|
||||
this.totalApples = this.entities.filter(e => e.type === 'apple').length;
|
||||
@@ -610,11 +610,14 @@ export class Level {
|
||||
}
|
||||
}
|
||||
|
||||
// 刺的判定盒:对齐齿尖、收窄到齿根之间(IWBT 三角形判定的矩形近似)。
|
||||
// 配合 11×21 的玩家判定盒,可以像素级贴刺、穿对刺缝。
|
||||
function spikeBox(t, tx, ty) {
|
||||
const x = tx * TILE, y = ty * TILE;
|
||||
if (t === T.SPIKE_U) return { x: x + 4, y: y + 11, w: TILE - 8, h: TILE - 12 };
|
||||
if (t === T.SPIKE_D) return { x: x + 4, y: y + 2, w: TILE - 8, h: TILE - 11 };
|
||||
if (t === T.SPIKE_L) return { x: x + 3, y: y + 4, w: TILE - 12, h: TILE - 8 };
|
||||
return { x: x + 9, y: y + 4, w: TILE - 12, h: TILE - 8 };
|
||||
if (t === T.SPIKE_U) return { x: x + 6, y: y + 8, w: TILE - 12, h: TILE - 8 }; // 齿尖 y+5,缝高 24
|
||||
if (t === T.SPIKE_D) return { x: x + 6, y: y + 1, w: TILE - 12, h: TILE - 9 }; // 齿尖 y+27
|
||||
if (t === T.SPIKE_L) return { x: x + 5, y: y + 6, w: TILE - 10, h: TILE - 12 }; // 齿尖 x+5,缝宽 22
|
||||
if (t === T.SPIKE_R) return { x: x + 5, y: y + 6, w: TILE - 10, h: TILE - 12 }; // 齿尖 x+27
|
||||
return { x: x + 6, y: y + 6, w: TILE - 12, h: TILE - 10 }; // KILLER(美味水果)
|
||||
}
|
||||
export { spikeBox };
|
||||
Reference in new issue
Block a user