Commit a2e94b21 by BellCodeEditor

save project

parent a9332621
Showing with 6 additions and 5 deletions
......@@ -11,6 +11,7 @@ food=pygame.image.load('apple.png')#食物 苹果
body=pygame.image.load('body.png')#身体
#创建一个窗口
x,y=240,120
ah=[(180,90),(180,120),(210,120),(x,y)]
scree=pygame.display.set_mode((660,480))
while True:
for event in pygame.event.get():
......@@ -18,17 +19,17 @@ while True:
if event.type==locals.QUIT:
exit()
x+=30
ah.append((x,y))
ah.pop(0)
#将背景图画上去
scree.blit(background,(0,0))
#将贪吃蛇的头画上去
scree.blit(right,(x,y))
scree.blit(right,ah[-1])
##将苹果画上去
scree.blit(food,(360,300))
#将贪吃蛇的身体画上去
scree.blit(body,(210,120))
scree.blit(body,(180,120))
scree.blit(body,(180,90))
for i in range(len(ah)-1):
scree.blit(body,ah[i])
#刷新画面
pygame.display.update()
FPSCLOCK.tick(fast)
......
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