Commit 432ab63e by BellCodeEditor

save project

parent a93cf6b7
Showing with 4 additions and 3 deletions
...@@ -43,7 +43,7 @@ while True: ...@@ -43,7 +43,7 @@ while True:
if event.key == locals.K_DOWN and snake_head != up: if event.key == locals.K_DOWN and snake_head != up:
snake_head = down snake_head = down
if event.key == locals.K_c and snake_head != up: if event.key == locals.K_c and snake_head != up:
ticktime+=10 ticktime+=5
# 设置贪吃蛇的头部坐标 # 设置贪吃蛇的头部坐标
if snake_head == right: if snake_head == right:
...@@ -69,6 +69,7 @@ while True: ...@@ -69,6 +69,7 @@ while True:
apple_X=30*randint(0,21) apple_X=30*randint(0,21)
apple_Y=30*randint(0,14) apple_Y=30*randint(0,14)
Score+=10 Score+=10
ticktime+=0.5
else: else:
position.pop(0) position.pop(0)
# if x>630 or x<0 or y>450 or y<0: # if x>630 or x<0 or y>450 or y<0:
...@@ -95,4 +96,4 @@ over_txt=over.render("Game Over",True,(0,0,0)) ...@@ -95,4 +96,4 @@ over_txt=over.render("Game Over",True,(0,0,0))
screen.blit(over_txt,(175,200)) screen.blit(over_txt,(175,200))
for i in range(6): for i in range(6):
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(ticktime) FPSCLOCK.tick(ticktime//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