Skip to content

Commit

Permalink
mobile controls update. tap to zoom to square
Browse files Browse the repository at this point in the history
  • Loading branch information
k2xl committed Jun 27, 2024
1 parent 6f0b3a1 commit c4c9ea1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions components/level/game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,14 @@ export default function Game({

const playerPosition = gameState.pos;

// if the position is one away from x,y then move the player
if (Math.abs(playerPosition.x - x) + Math.abs(playerPosition.y - y) === 1) {
// let's move the player to the cell clicked
const dist = Math.abs(x - playerPosition.x + y - playerPosition.y);
let breaker = 0;

while (breaker < dist) {
moveByDXDY(x - playerPosition.x, y - playerPosition.y);
validTouchStart.current = false;
breaker++;
}
}

Expand Down

0 comments on commit c4c9ea1

Please sign in to comment.