Commit a8643c95 by BellCodeEditor

save project

parent 1f816b4e
Showing with 9 additions and 9 deletions
......@@ -27,7 +27,7 @@ while True:
if event.type == locals.QUIT:
# 接收到退出事件后退出程序
exit()
if event.type == locals.KEYDOWN:
elif event.type == locals.KEYDOWN:
if event.key==locals.K_RIGHT and satheading != 'left':
setheading='right'
snake_head=right
......@@ -41,15 +41,14 @@ while True:
setheading='down'
snake_head=down
x+=30
if satheading=='right':
X += 30
if satheading=='left':
X -= 30
if satheading=='up':
Y += 30
x += 30
elif satheading=='left':
x -= 30
elif satheading=='up':
y -= 30
else:
X -= 30
y += 30
position.append((x,y))
position.pop(0)
# 将背景图画上去
......@@ -67,4 +66,4 @@ while True:
screen.blit(food, (360, 300))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(3)
FPSCLOCK.tick(3)
\ 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