Commit 26070c32 by BellCodeEditor

save project

parent 101b77d2
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.type==locals.K_RIGHT and s !="left": if event.key==locals.K_RIGHT and s !="left":
s="right" s="right"
s_h=right s_h=right
if event.type==locals.K_LEFT and s !="right": if event.key==locals.K_LEFT and s !="right":
s="left" s="left"
s_h=left s_h=left
if event.type==locals.K_DOWN and s !="up": if event.key==locals.K_DOWN and s !="up":
s="down" s="down"
s_h=down s_h=down
if event.type==locals.K_UP and s !="down": if event.key==locals.K_UP and s !="down":
s="up" s="up"
s_h=up s_h=up
if s=="right": if s=="right":
...@@ -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()
FPSCLOCK.tick(1) FPSCLOCK.tick(3)
\ 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