Skip to content

Commit 0f72354

Browse files
committed
switchPressedの更新エラーを修正
1 parent 1d21332 commit 0f72354

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/grid.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ export class Grid {
353353
vprev.block = Block.switchPressed;
354354
vprev.dy = 0;
355355
vprev.vy = 0;
356-
} else if (vprev?.block === Block.switchPressed) {
356+
} else if (vprev?.block === Block.switchPressed && cNewCell.block === Block.switch) {
357357
// switchがプレイヤーに押されているのが戻るとき
358358
assert(
359-
cprev.block === Block.switchPressed || cprev.block === Block.switch,
359+
cprev.block === Block.switchPressed || cprev.block === Block.switch || cprev.block === Block.movable,
360360
"block is not switch or switchPressed",
361361
);
362362
const switchId = cprev.switchId;
@@ -374,7 +374,7 @@ export class Grid {
374374
vprev.vy = 0;
375375
}
376376
// switch上にオブジェクトを置くとき
377-
else if (vprev?.block === Block.switch) {
377+
else if (vprev?.block === Block.switch || vprev?.block === Block.switchPressed) {
378378
if (cNewCell.block !== Block.movable && cNewCell.block !== Block.fallable) {
379379
console.warn("No block other than movable cannot be placed on the switch");
380380
console.log("cell.block", cNewCell.block);

0 commit comments

Comments
 (0)