From 05109ebb0cfec6b1cec5537e6c3f2a9693f89e5c Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 18 Nov 2023 16:16:24 +0800 Subject: [PATCH] auto save --- snake.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/snake.py b/snake.py index 09a798b..a1909d9 100644 --- a/snake.py +++ b/snake.py @@ -29,7 +29,10 @@ position = [(180, 90), (180, 120), (210, 120), (x, y)] setheading = "right" snake_head = right -while True: +apple—x=240 +apple_y=180 + +while True:apple_y=180 for event in pygame.event.get(): if event.type == locals.QUIT: # 接收到退出事件后退出程序 @@ -58,6 +61,8 @@ while True: else: y += 30 position.append((x, y)) + + # 将背景图画上去 if a_x ==x and a_y ==y: a1=random.randint(0,21) @@ -83,4 +88,4 @@ while True: text=my_font.render(info,True,(0,0,0)) screen.blit(text,(540,0)) pygame.display.update() - FPSCLOCK.tick(3) \ No newline at end of file + FPSCLOCK.tick(3) -- libgit2 0.25.0