Commit f1090a8b by BellCodeEditor

auto save

parent d5739bd2
Showing with 8 additions and 2 deletions
import pygame import pygame
import random
from pygame import locals from pygame import locals
# 初始化pygame,为使用硬件做准备 # 初始化pygame,为使用硬件做准备
...@@ -51,6 +52,10 @@ while True: ...@@ -51,6 +52,10 @@ while True:
y -= 30 y -= 30
else: else:
y += 30 y += 30
pos.pop
if food_x==x and food_y==y:
food_x=30*randon.randing(0,21)
food_y=30*randon.randing(0,15)
position.append((x, y)) position.append((x, y))
position.pop(0) position.pop(0)
# 将背景图画上去 # 将背景图画上去
...@@ -65,4 +70,5 @@ while True: ...@@ -65,4 +70,5 @@ while True:
screen.blit(food, (360, 300)) screen.blit(food, (360, 300))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPSCLOCK.tick(3) 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