-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix hidden layer tile selection bug #27
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
src/zustand/game-store.ts
Outdated
const { gameBoard: board } = get(); | ||
const { row, layer } = board[index]; | ||
const currentTile = board[index]; | ||
const { row, layer, column } = currentTile; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destructure directly
src/zustand/game-store.ts
Outdated
board[j].layer === layer + 1 && | ||
board[j].column === column; | ||
}) | ||
.map((j: string) => j); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant statement.
}) | ||
.map((j: string) => j); | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const isCoveringItem = (row: number, layer: number, column: number) => { | |
const coveringItems = Object.keys(board); | |
.filter((j) => { | |
return board[j].row === row - 1 && | |
board[j].layer === layer + 1 && | |
board[j].column === column; | |
}) | |
return !!coveringItems && coveringItems[0] | |
}; |
@@ -159,6 +171,11 @@ export const useGameStore = create<GameState>()( | |||
.map((i: string) => i); | |||
}; | |||
|
|||
// Check if covering tile exists | |||
if (coveringItem(row, layer, column).length !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (coveringItem(row, layer, column).length !== 0) { | |
if (isCoveringItem(row, layer, column)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe so schlecht, nee geht nicht, dass man direkt ne andere Implementation suggested.
Wahrscheinlich auch um das discouragen.
@@ -159,6 +171,11 @@ export const useGameStore = create<GameState>()( | |||
.map((i: string) => i); | |||
}; | |||
|
|||
// Check if covering tile exists | |||
if (coveringItem(row, layer, column).length !== 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe so schlecht, nee geht nicht, dass man direkt ne andere Implementation suggested.
Wahrscheinlich auch um das discouragen.
Issue should be fixed without affecting any special tiles.