> `> // Declare a constant, neighborCubes, below
> const neighborCubes = getNeighbors();
> // Remove matching cubes from game if there's at least 2 of them
> if (neighborCubes.length > 0) {
> // Update score
> score += neighborCubes.length;
> scoreText.setText(`Score: ${score}`);
> // Update each cube in neighborCubes here
> neighborCubes.forEach(neighbor => {
> neighbor.destroy();
> });
> removeCols();
}
// Helper function moves cube sprites down
function renderCubes(cube) {
for (let row = 0; row < cube.row; row++) {
// Move cube sprite down by 30px
board[cube.col][row].y += cubeSize;
// Update the row of cube
board[cube.col][row].row += 1;
}
// Update board array
let removed = board[cube.col].splice(cube.row, 1);
board[cube.col] = removed.concat(board[cube.col]);
}
});
renderCubes(neighbor);
}`
I’m losing my marbles and can’t figure out why nothing disappears when I click my mouse anywhere on the cubes. Is there something I am missing with the prompt telling me, “Remove matching cubes from game if there’s at least 2 of them”.
I feel really lost and the dev project isn’t really helping me resolve this. Can anyone help a brother out? To understand why this isn’t working and what will make it work. You are more appreciated than you know, thank you.