So I watched a tutorial on how to make tetris in javascript. And at the end, he wrote a for loop to check if the row has been filled. Unfortunately, I don't understand how does it work. I would be very please and thankful if someone could explain how the block works. Thank you for reading, this is the loop:
function sweeper(){
outer: for (y=arena.length-1;y>0; --y){
for (x=0;x<arena[y].length;++x){
if(arena[y][x]===0){
continue outer;
}
}
const row = arena.splice(y,1)[0].fill(0);
arena.unshift(row);
++y;
scoreUpdate();
}
}
Aucun commentaire:
Enregistrer un commentaire