fix: 刺放置方向问题

This commit is contained in:
cancerai committed 2026-10-22 21:42:43 +08:00
1 parent 6ba47dfd88
commit bf0f065432
8 files changed
+580 -120

No files matched your search

+10 -3
View File
@@ -297,7 +297,7 @@ export class Player {
case 'save':
if (!e.active) {
e.active = true;
this.savePoint = { x: e.x + e.w / 2 - this.w / 2, y: e.y + e.h - this.h };
this.savePoint = { x: e.x + e.w / 2 - this.w / 2, y: e.y + e.h - this.h, face: (this.level.faceIndex ?? 0) };
this.saveIdx = e.no || 1;
sfx.save();
L.particles.spawn(e.x + e.w / 2, e.y + e.h / 2, 18,
@@ -326,8 +326,15 @@ export class Player {
case 'warp': {
if (e.cool > 0) break;
e.cool = 40;
const tgt = e.to === 'spawn' ? L.spawn
: e.to ? { x: e.to[0] * TILE, y: e.to[1] * TILE }
const to = e.to;
// 自制多面地图的跨面传送门:to = {face, door} —— 交给 main 切换面
if (to && typeof to === 'object' && !('x' in to) && !('y' in to) && typeof to.face === 'number') {
if (this.onPortal) this.onPortal(e);
break;
}
// 原有逻辑(同关内传送 / 回出生点 / 绝对坐标 / pair 配对)
const tgt = to === 'spawn' ? L.spawn
: to && ('x' in to) ? { x: to.x * TILE, y: to.y * TILE }
: (() => {
const p = L.entities.find(o => o.type === 'warp' && o.idx === e.pair);
return p ? { x: p.x + p.w / 2 - this.w / 2, y: p.y + p.h - this.h } : null;