Skip to content

Commit

Permalink
fix(frontend): fix game replay
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo authored Jan 9, 2024
1 parent 7e52ea4 commit f5b864d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/frontend/src/scripts/drop-and-fusion-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,13 @@ export class DropAndFusionGame extends EventEmitter<{
});
this.emit('changeStock', this.stock);

const x = Math.min(this.gameWidth - this.PLAYAREA_MARGIN - (head.mono.size / 2), Math.max(this.PLAYAREA_MARGIN + (head.mono.size / 2), Math.round(_x)));
const inputX = Math.round(_x);
const x = Math.min(this.gameWidth - this.PLAYAREA_MARGIN - (head.mono.size / 2), Math.max(this.PLAYAREA_MARGIN + (head.mono.size / 2), inputX));
const body = this.createBody(head.mono, x, 50 + head.mono.size / 2);
this.logs.push({
frame: this.frame,
operation: 'drop',
x,
x: inputX,
});
Matter.Composite.add(this.engine.world, body);
this.activeBodyIds.push(body.id);
Expand Down

0 comments on commit f5b864d

Please sign in to comment.