import time
from pygame.locals import *
import random
from block import *
from blockgroup import *
#初始化游戏窗口
pygame.init()
window=pygame.display.set_mode(size=(800,600))
# #实例化方块
# B=block(random.randint(0,5),400,8000,50,100,(100,200))
# C=block(random.randint(0,5),100,200,50,50,(400,200))
# blocks=[]
# colid = 50
# for i in range(Game_Row):
# b=[]
# rowid = 240
#
# for j in range(Game_col):
# b.append(block(random.randint(0,colour_type.blockmax-1),i,j,32,32,(rowid,colid)))
# rowid+=32
# colid+=32
# blocks.append(b)
blocksgroup=[]
y = 20
m=400
drop_true=1
block_pos_list=[]
for x in range(1):
conf = block_group.GenratevlockgroupConfig(m, y, (32, 32))
blocksgroup.append(block_group(32, 32, conf, (240, 50),block_pos_list))
while True:
if drop_true!=1:
for x in range(1):
conf = block_group.GenratevlockgroupConfig(m, y, (32, 32))
blocksgroup.append(block_group(32, 32, conf, (240, 50),block_pos_list))
print("生成了新的方块组")
# y = 4 * 40
for event in pygame.event.get():
if event.type==QUIT:
print(event)
pygame.quit()
sys.exit()
for bg in blocksgroup:
bg.update()
#每次渲染前都要将窗口还原成黑色
window.fill((0,0,0))
# #调用方块渲染窗口图片
for bg in blocksgroup:
drop_true=bg.draw(window)
pygame.display.update()