Answer the question
In order to leave comments, you need to log in
How to make a collision in Tetris?
Hello.
In general, I continue to play around with JavaScript (I write Tetris). I ran into a problem: I don’t know how best to make a collision for Tetris. The blocks themselves consist of a matrix, and I can also represent the playing field in the form of a matrix using:
const arena = createMatrix(12, 20);
console.log(arena);
console.table(arena);
Answer the question
In order to leave comments, you need to log in
The second 4x4 matrix in which the falling figure is placed. On each "tick" or user action, add the values from the cells of the matrix and the corresponding piece of the arena, and check if there is a deuce.
PS: You forgot the "stick". It is important :)
Is this not your course on Udemy? The names of functions, variables and the whole structure are very similar.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question