Commit de9bf3e7 by BellCodeEditor

save project

parent 6842347e
Showing with 11 additions and 3 deletions
...@@ -42,7 +42,15 @@ while True: ...@@ -42,7 +42,15 @@ while True:
setheading = 'down' setheading = 'down'
snake_head = down snake_head = down
x += 30 #设置贪吃蛇的头部坐标
if setheading == "right":
x += 30
elif setheading == "left":
x -= 30
elif setheading == "up":
y -= 30
else:
y += 30
position.append((x,y)) position.append((x,y))
position.pop(0) position.pop(0)
# 将背景图画上去 # 将背景图画上去
...@@ -57,4 +65,4 @@ while True: ...@@ -57,4 +65,4 @@ while True:
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSLOCK.tick(3) FPSLOCK.tick(5)
\ No newline at end of file \ 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