How to rotate a block in python without getting through in grid and the other blocks in tetris | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

How to rotate a block in python without getting through in grid and the other blocks in tetris

The block doesn't rotating and also the block keeps on getting through in other blocks

13th Apr 2024, 1:55 PM
Cherry Mae Enarciso
Cherry Mae Enarciso - avatar
2 Respostas
+ 2
You can implement collision detection algorithms Mentor sir Ausgrindtube already mentioned. This Algorithm can check for overlaps with existing blocks after each rotation operation. If a collision is detected, prevent the rotation from occurring or adjust the block's position accordingly to avoid trespassing onto other blocks.
13th Apr 2024, 3:49 PM
`Š½Ń‚Ń‚pā“ā°ā¶
`Š½Ń‚Ń‚pā“ā°ā¶ - avatar
+ 1
You would have to program them to "collide" or know of the space of the other blocks etc.
13th Apr 2024, 2:23 PM
Ausgrindtube
Ausgrindtube - avatar