right click function in p5js code example
Example: right click function in p5js
console.log(mouseButton)
console.log(event.button)
if (mouseButton === CENTER) { // Handle Flag on Right Click TODO: add remove flag if already exists
working_board.set_square(xSquare, ySquare, 3)
} else { // Handle any other tile
if (number_board.get_square(xSquare, ySquare) >= 1 && number_board.get_square(xSquare, ySquare) <= 8) { // Handle Number Square
working_board.reveal_single_tile(xSquare, ySquare);
} else if (number_board.get_square(xSquare, ySquare) == 0) { // Handle Clear Square
working_board.reveal_tiles(xSquare, ySquare);
} else if (working_board.get_square(xSquare, ySquare) == 2) { // Handle Bomb Tile
working_board.set_square(xSquare, ySquare, 3);
} // TODO: Add Functionality for Clicking a number tile already cleared
}