Commit 87be6680 by BellCodeEditor

save project

parent 7f597e93
Showing with 10 additions and 4 deletions
...@@ -8,6 +8,7 @@ grid_num_width = 15 # 横向格子数量 ...@@ -8,6 +8,7 @@ grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量 grid_num_height = 25 # 纵向格子数量
FPS = 30 FPS = 30
xy=[7,2] xy=[7,2]
trapezoid=[(0,0),(-1,0),(1,0),(0,-1)]
# 创建窗口 # 创建窗口
screen = pygame.display.set_mode((460, 500)) screen = pygame.display.set_mode((460, 500))
...@@ -18,8 +19,8 @@ background = pygame.image.load('bg.png') ...@@ -18,8 +19,8 @@ background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体 font = pygame.font.Font('STKAITI.TTF', 60) # 字体
font = pygame.font.Font('minecraft_font.ttf', 60) # 字体 font = pygame.font.Font('minecraft_font.ttf', 60) # 字体
def draw(R,G,B,x,y,dx,dy,a): def draw(R,G,B,xy,dx,dy,a):
pygame.draw.rect(screen,(R,G,B),(x*20-20,y*20-20,dx,dy),a) pygame.draw.rect(screen,(R,G,B),(xy[0]*20-20,xy[1]*20-20,dx,dy),a)
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -40,8 +41,13 @@ while True: ...@@ -40,8 +41,13 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background,(0,0)) screen.blit(background,(0,0))
draw(255,0,0,xy[0],xy[1],20,20,0) current_pos=[]
draw(255,255,255,xy[0],xy[1],20,20,1) for cube in trapezoid:
pos=(cube[0]+xy[0],cube[1]+xy[1])
current_pos.append(pos)
for cube in current_pos:
draw(255,0,0,cube,20,20,0)
draw(255,255,255,cube,20,20,1)
# 得分 # 得分
score_text=font.render(str(score),True,(0,0,0)) score_text=font.render(str(score),True,(0,0,0))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment