fix: 修复了冰块惯性问题和死亡效果
This commit is contained in:
1 parent
47a462be01
commit
4b3dfd635b
15 files changed
+633
-38
No files matched your search
+32
@@ -87,6 +87,7 @@ export class Level {
|
||||
/** 完整重置(死亡 / 重开) */
|
||||
reset(full = false) {
|
||||
// tiles 状态(vanish 等)
|
||||
if (full) this.deathMarks = []; // 死亡血迹只在整关重开时清空,复活后保留
|
||||
this.vanish = new Map();
|
||||
this.bullets = [];
|
||||
this.ebullets = [];
|
||||
@@ -241,6 +242,32 @@ export class Level {
|
||||
}
|
||||
}
|
||||
|
||||
// 死亡标记:在死亡地点留下一个常驻「红叉」(IWBTG 风格死亡指示)。
|
||||
// 只保留上一次死亡的红叉:新增前先清空,多次死亡不会累积。
|
||||
addDeathMark(x, y) {
|
||||
this.deathMarks.length = 0;
|
||||
this.deathMarks.push({ x, y });
|
||||
}
|
||||
|
||||
drawDeathMark(ctx, dm) {
|
||||
const s = 4; // 红叉半边长(< kid 的 11×21,整体约 8px)
|
||||
ctx.lineCap = 'round';
|
||||
// 深色描边,保证在任意背景下都清晰
|
||||
ctx.lineWidth = 3;
|
||||
ctx.strokeStyle = 'rgba(0,0,0,0.55)';
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(dm.x - s, dm.y - s); ctx.lineTo(dm.x + s, dm.y + s);
|
||||
ctx.moveTo(dm.x + s, dm.y - s); ctx.lineTo(dm.x - s, dm.y + s);
|
||||
ctx.stroke();
|
||||
// 红色主体
|
||||
ctx.lineWidth = 2;
|
||||
ctx.strokeStyle = '#ff2535';
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(dm.x - s, dm.y - s); ctx.lineTo(dm.x + s, dm.y + s);
|
||||
ctx.moveTo(dm.x + s, dm.y - s); ctx.lineTo(dm.x - s, dm.y + s);
|
||||
ctx.stroke();
|
||||
}
|
||||
|
||||
// ---------------- 查询 ----------------
|
||||
tileAt(tx, ty) {
|
||||
if (tx < 0 || ty < 0 || tx >= this.w || ty >= this.h) return ty < 0 ? T.EMPTY : T.BLOCK;
|
||||
@@ -458,6 +485,8 @@ export class Level {
|
||||
if (this.shake > 0) this.shake *= 0.86;
|
||||
if (this.toastT > 0 && --this.toastT === 0) this.toast = null;
|
||||
this.particles.update();
|
||||
|
||||
// 死亡红叉为常驻静态标记,无需逐帧演化,复活后仍保留
|
||||
}
|
||||
|
||||
fireEvent(ev, player) {
|
||||
@@ -587,6 +616,9 @@ export class Level {
|
||||
for (const b of this.bullets) S.drawBullet(ctx, b);
|
||||
for (const b of this.ebullets) S.drawEBullet(ctx, b, t);
|
||||
|
||||
// 死亡血迹(IWBTG 风格,常驻于死亡地点)
|
||||
for (const dm of this.deathMarks) this.drawDeathMark(ctx, dm);
|
||||
|
||||
this.particles.draw(ctx);
|
||||
ctx.restore();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user