Commit ea22d4d8 by BellCodeEditor

save project

parent c3ddfb44
Showing with 6 additions and 6 deletions
...@@ -27,16 +27,16 @@ while True: ...@@ -27,16 +27,16 @@ while True:
exit() exit()
if event.type == locals.KEYDOWN: if event.type == locals.KEYDOWN:
if event.key == locals.K_RIGHT and setheading != 'left': if event.key == locals.K_RIGHT and setheading != 'left':
setheading == 'right' setheading = "right"
set_head = right set_head = right
if event.key == locals.K_LEFT and setheading != 'right': if event.key == locals.K_LEFT and setheading != 'right':
setheading == 'left' setheading = "left"
set_head = left set_head = left
if event.key == locals.K_UP and setheading != 'down': if event.key == locals.K_UP and setheading != 'down':
setheading == 'up' setheading = "up"
set_head = up set_head = up
if event.key == locals.K_DOWN and setheading != 'up': if event.key == locals.K_DOWN and setheading != 'up':
setheading == 'down' setheading = "down"
set_head = down set_head = down
if setheading == "right": if setheading == "right":
x += 30 x += 30
...@@ -60,4 +60,4 @@ while True: ...@@ -60,4 +60,4 @@ while True:
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(3) FPS.tick(1)
\ 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