chore: add information on piece rotation

This commit is contained in:
2021-06-03 17:01:34 -04:00
parent 13de15c5fd
commit 2c19289f36

View File

@@ -49,7 +49,10 @@ class Piece: # TODO game objects base class / interface?
point[0] += vector[0]
point[1] += vector[1]
# rotate the piece clockwise
'''
For more information on a rotation of a piece go here:
https://gamedev.stackexchange.com/questions/17974/how-to-rotate-blocks-in-tetris
'''
def rotate(self):
for sub_points in self.points:
for point in sub_points:
@@ -60,4 +63,5 @@ class Piece: # TODO game objects base class / interface?
point[1] = (h * -1) + self.center[1]
# shape attributes
I_SHAPE = (((0, 0), (1, 0), (1, 1), (0, 1)), ((1, 0), (2, 0), (2, 1), (1, 1)), ((2, 0, True), (3, 0), (3, 1), (2, 1)), ((3, 0), (4, 0), (4, 1), (3, 1)))
I_SHAPE = (((0, 0), (1, 0), (1, 1), (0, 1)), ((1, 0), (2, 0), (2, 1), (1, 1)), ((2, 0, True), (3, 0), (3, 1), (2, 1)), ((3, 0), (4, 0), (4, 1), (3, 1)))
O_PIECE = ()