Commit fae2f5e2 by BellCodeEditor

save project

parent 5e1f090f
Showing with 3 additions and 3 deletions
...@@ -22,7 +22,7 @@ setheading = "right" ...@@ -22,7 +22,7 @@ setheading = "right"
snake_head = right snake_head = right
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT:# 接收到退出事件后退出程序 if event.type == locals.QUIT or (x<0 or x>630 or y<0 or y>450):# 接收到退出事件后退出程序
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":
...@@ -61,4 +61,4 @@ while True: ...@@ -61,4 +61,4 @@ while True:
text = my_font.render(info,True,(0,0,0)) text = my_font.render(info,True,(0,0,0))
screen.blit(text,(10,10)) # 刷新画面 screen.blit(text,(10,10)) # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) FPSCLOCK.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