Commit 8b3f62e4 by BellCodeEditor

save project

parent ffcc4077
Showing with 8 additions and 3 deletions
......@@ -7,10 +7,12 @@ pygame.init()
# 创建一个窗口
screen = pygame.display.set_mode((660, 480))
#创建一个帧率的钟
FPSCLOCK = pygame.time.Clock()
x = 240
y = 120
move = [(180, 90),(180, 120),(210, 120),(x,y)]
# 背景
background = pygame.image.load('bg.png')
......@@ -23,9 +25,8 @@ while True:
# 将贪吃蛇画上去
screen.blit(right, (x, y))
# 将贪吃蛇的身体画上去
screen.blit(body, (210, 120))
screen.blit(body, (180, 120))
screen.blit(body, (180, 90))
for i in range(len(move)-1):
screen.blit(body,move[i])
# 将果实画上去
screen.blit(food, (360, 300))
x+=30
......@@ -33,6 +34,9 @@ while True:
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
move.pop(0)
move.append((x,y))
#设置帧率
FPSCLOCK.tick(3)
# 刷新画面
pygame.display.update()
\ No newline at end of file
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