Skip to content

Commit

Permalink
[fix] cooks positions on reload
Browse files Browse the repository at this point in the history
  • Loading branch information
cupoftea4 committed Dec 11, 2023
1 parent afbaa06 commit 0560b73
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/types/canvasCook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,18 @@ export class CanvasCook {
this.currentStage = currentStage;

const [x, y, dx, dy] = COOK_POSITIONS[currentStage];
this.targetX = x + dx * stageCooksCount * 50;
this.targetY = y + dy * stageCooksCount * 50;
if (stageCooksCount > 6) {
if (stageCooksCount > 11) {
[this.targetX, this.targetY] = [x, y];
} else {
[this.targetX, this.targetY] = [
x + (25 * dx) + dx * (stageCooksCount - 6) * 50,
y + (25 * dy) + dy * (stageCooksCount - 6) * 50
];
}
} else {
[this.targetX, this.targetY] = [x + dx * stageCooksCount * 50, y + dy * stageCooksCount * 50];
}

this.moving = false;

Expand Down

0 comments on commit 0560b73

Please sign in to comment.