chore: add information on piece rotation
This commit is contained in:
@@ -49,7 +49,10 @@ class Piece: # TODO game objects base class / interface?
|
|||||||
point[0] += vector[0]
|
point[0] += vector[0]
|
||||||
point[1] += vector[1]
|
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):
|
def rotate(self):
|
||||||
for sub_points in self.points:
|
for sub_points in self.points:
|
||||||
for point in sub_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]
|
point[1] = (h * -1) + self.center[1]
|
||||||
|
|
||||||
# shape attributes
|
# 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 = ()
|
||||||
|
|||||||
Reference in New Issue
Block a user