Commit 87be6680 by BellCodeEditor

save project

parent 7f597e93
Showing with 11 additions and 5 deletions
......@@ -8,6 +8,7 @@ grid_num_width = 15 # 横向格子数量
grid_num_height = 25 # 纵向格子数量
FPS = 30
xy=[7,2]
trapezoid=[(0,0),(-1,0),(1,0),(0,-1)]
# 创建窗口
screen = pygame.display.set_mode((460, 500))
......@@ -18,8 +19,8 @@ background = pygame.image.load('bg.png')
font = pygame.font.Font('STKAITI.TTF', 60) # 字体
font = pygame.font.Font('minecraft_font.ttf', 60) # 字体
def draw(R,G,B,x,y,dx,dy,a):
pygame.draw.rect(screen,(R,G,B),(x*20-20,y*20-20,dx,dy),a)
def draw(R,G,B,xy,dx,dy,a):
pygame.draw.rect(screen,(R,G,B),(xy[0]*20-20,xy[1]*20-20,dx,dy),a)
while True:
for event in pygame.event.get():
......@@ -40,9 +41,14 @@ while True:
# 将背景图画上去
screen.blit(background,(0,0))
draw(255,0,0,xy[0],xy[1],20,20,0)
draw(255,255,255,xy[0],xy[1],20,20,1)
current_pos=[]
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))
screen.blit(score_text,(350,70))
......
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