Skip to content

Commit

Permalink
fix: correct logic in moveFramePosition
Browse files Browse the repository at this point in the history
  • Loading branch information
thirdmadman committed Apr 15, 2024
1 parent ad57c20 commit 3e52734
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/app/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,12 @@ export class App {
}

moveFramePosition(x: number, y: number) {
if (this.framePositionX <= this.worldSideSize - this.frameWidth + x && this.framePositionX + x >= 0) {
if (this.framePositionX + x <= this.worldSideSize - this.frameWidth && this.framePositionX + x >= 0) {
this.framePositionX += x;
this.engine.setFramePosition(this.framePositionX, this.framePositionY);
console.error(x);
}

if (this.framePositionY <= this.worldSideSize - this.frameHeight + y && this.framePositionY + y >= 0) {
if (this.framePositionY + y <= this.worldSideSize - this.frameHeight && this.framePositionY + y >= 0) {
this.framePositionY += y;
this.engine.setFramePosition(this.framePositionX, this.framePositionY);
}
Expand Down

0 comments on commit 3e52734

Please sign in to comment.