Cube Matcher help. Stuck and confused on step 13

> `> // 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.

I don’t have access anymore to confirm, but I’ll give it a shot.

If I recall correctly, getNeighbors() is a helper function provided already. Check the definition of that function to see if it takes any arguments because I believe it should if it’s meant to get neighbors of something.

You can log the value of neighborCubes.length to see if it’s returning anything too.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.