Skip to content

Commit

Permalink
add move sound
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinjude committed Nov 12, 2023
1 parent d222249 commit af154bf
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
Binary file added public/sounds/move.mp3
Binary file not shown.
2 changes: 2 additions & 0 deletions src/components/ChessBoard/ChessBoard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ const ChessBoard = ({ fen, onChange: setFen, disabled }: ChessBoardProps) => {
],
});

playSound("MOVE");

if (setFen) setFen(fenAfterMove);

setCurrentCell({ row: newRow, col: newCol });
Expand Down
1 change: 1 addition & 0 deletions src/contexts/Sound/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const sounds = {
CELL_CLICK: "click.mp3",
RANDOM_FEN: "random.mp3",
SWITCH: "switch.mp3",
MOVE: "move.mp3",
};

export type SoundContextType = {
Expand Down

0 comments on commit af154bf

Please sign in to comment.