Hi there! I’m working now on this tutorial of Tetris that u have (Code Tetris: JavaScript Tutorial for Beginners - YouTube). In 48 mins, she talked about the freeze function. The problem is that it doesn’t work for me.
I tried copying and pasting the code of her Github but I’m in the same situation, the tetrominos doesn’t stop.
The JS code is:
function moveDown(){
undraw()
currentPosition += width
draw()
freeze()
}
// Función freeze para detener los tetraminos
function freeze() {
if(current.some(index => squares[currentPosition + index + width].classList.contains('taken'))) {
current.forEach(index => squares[currentPosition + index].classList.add('taken'))
}
}
And in HTML I added the 10 div below the others with the class “taken”.
Can u help me please?