How to rotate a block in python without getting through in grid and the other blocks in tetris | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
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 Réponses
+ 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