Commit 566ea75e by BellCodeEditor

save project

parent e662cb10
Showing with 9 additions and 3 deletions
...@@ -27,7 +27,8 @@ snake_head = right ...@@ -27,7 +27,8 @@ snake_head = right
apple_y = 300 apple_y = 300
apple_x = 360 apple_x = 360
score = 0 score = 0
tick = 0 speed = 3
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:
...@@ -84,6 +85,11 @@ while True: ...@@ -84,6 +85,11 @@ while True:
info = "Score:" + str(score) info = "Score:" + str(score)
text = my_font.render(info,True,(255,255,0)) text = my_font.render(info,True,(255,255,0))
screen.blit(text,(540,10)) screen.blit(text,(540,10))
#jiasu
if score > 2 and score <= 4 and speed == 3:
speed += 1
elif score > 4 and score <= 9 and speed == 4:
speed += 1
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(4) FPSCLOCK.tick(speed)
\ 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