定义游戏区域的宽度和高度
play_width, play_height = 10 * block_size, 20 * block_size
定义游戏区域的起始位置
play_x, play_y = (width - play_width) // 2, height - play_height - 50
定义颜色
black = (0, 0, 0)
white = (255, 255, 255)
blue = (0, 0, 255)
red = (255, 0, 0)
green = (0, 255, 0)
yellow = (255, 255, 0)
purple = (128, 0, 128)
orange = (255, 165, 0)
cyan = (0, 255, 255)
定义方块的形状
S = [[‘…’,
‘…’,
‘…00.’,
‘.00…’,
‘…’],
[‘…’,
‘…0…’,
‘…00.’,
‘…0.’,
‘…’]]
Z = [[‘…’,
‘…’,
‘.00…’,
‘…00.’,
‘…’],
[‘…’,
‘…0…’,
‘.00…’,
‘.0…’,
‘…’]]
I = [[‘…’,
‘…0…’,
‘…0…’,
‘…0…’,
‘…0…’],
[‘…’,
‘0000.’,
‘…’,
‘…’,
‘…’]]
O = [[‘…’,
‘…’,
‘.00…’,
‘.00…’,
‘…’]]
J = [[‘…’,
‘.0…’,
‘.000.’,
‘…’,
‘…’],
[‘…’,
‘…00.’,
‘…0…’,
‘…0…’,
‘…’],
[‘…’,
‘…’,
‘.000.’,
‘…0.’,
‘…’],
[‘…’,
‘…0…’,
‘…0…’,
‘.00…’,
‘…’]]
L = [[‘…’,
‘…0.’,
‘.000.’,
‘…’,
‘…’],
[‘…’,
‘…0…’,
‘…0…’,
‘…00.’,
‘…’],
[‘…’,
‘…’,
‘.000.’,
‘.0…’,
‘…’],
[‘…’,
‘.00…’,
‘…0…’,
‘…0…’,
‘…’]]
T = [[‘…’,
‘…0…’,
‘.000.’,
‘…’,
‘…’],
[‘…’,
‘…0…’,
‘…00.’,
‘…0…’,