@@ -52,15 +52,16 @@ def __init__(self,bx,by):
52
52
self .start_x = math .ceil (self .resx / 2.0 )
53
53
self .start_y = constants .BOARD_UP_MARGIN + constants .BOARD_HEIGHT + constants .BOARD_MARGIN
54
54
# Blocka data (shapes and colors). The shape is encoded in the list of [X,Y] points. Each point
55
- # represents the relative position.
55
+ # represents the relative position. The true/false value is used for the configuration of rotation where
56
+ # False means no rotate and True allows the rotation.
56
57
self .block_data = (
57
- ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[3 ,0 ]],constants .RED ), # I block
58
- ([[0 ,0 ],[1 ,0 ],[0 ,1 ],[- 1 ,1 ]],constants .GREEN ), # S block
59
- ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[2 ,1 ]],constants .BLUE ), # J block
60
- ([[0 ,0 ],[0 ,1 ],[1 ,0 ],[1 ,1 ]],constants .ORANGE ), # O block
61
- ([[- 1 ,0 ],[0 ,0 ],[0 ,1 ],[1 ,1 ]],constants .GOLD ), # Z block
62
- ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[1 ,1 ]],constants .PURPLE ), # T block
63
- ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[0 ,1 ]],constants .CYAN ), # J block
58
+ ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[3 ,0 ]],constants .RED , True ), # I block
59
+ ([[0 ,0 ],[1 ,0 ],[0 ,1 ],[- 1 ,1 ]],constants .GREEN , True ), # S block
60
+ ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[2 ,1 ]],constants .BLUE , True ), # J block
61
+ ([[0 ,0 ],[0 ,1 ],[1 ,0 ],[1 ,1 ]],constants .ORANGE , False ), # O block
62
+ ([[- 1 ,0 ],[0 ,0 ],[0 ,1 ],[1 ,1 ]],constants .GOLD , True ), # Z block
63
+ ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[1 ,1 ]],constants .PURPLE , True ), # T block
64
+ ([[0 ,0 ],[1 ,0 ],[2 ,0 ],[0 ,1 ]],constants .CYAN , True ), # J block
64
65
)
65
66
# Compute the number of blocks. When the number of blocks is even, we can use it directly but
66
67
# we have to decrese the number of blocks in line by one when the number is odd (because of the used margin).
@@ -303,7 +304,7 @@ def get_block(self):
303
304
# Get the block and add it into the block list(static for now)
304
305
tmp = random .randint (0 ,len (self .block_data )- 1 )
305
306
data = self .block_data [tmp ]
306
- self .active_block = block .Block (data [0 ],self .start_x ,self .start_y ,self .screen ,data [1 ])
307
+ self .active_block = block .Block (data [0 ],self .start_x ,self .start_y ,self .screen ,data [1 ], data [ 2 ] )
307
308
self .blk_list .append (self .active_block )
308
309
self .new_block = False
309
310
0 commit comments