Commit cc5b34e7 by BellCodeEditor

auto save

parent df29608d
Showing with 19 additions and 4 deletions
......@@ -6,7 +6,7 @@ from pygame import locals
pygame.init()
# 创建一个窗口
screen = pygame.display.set_mode((660, 480))
screen = pygame.display.set_mode((661, 481))
FPSCLOCK = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 背景
......@@ -17,9 +17,10 @@ body = pygame.image.load('body.png') # 身体
left = pygame.image.load('left.png') # 头 朝左
up = pygame.image.load('up.png') # 头 朝上
down = pygame.image.load('down.png') # 头 朝下
my=
x2=330
y2=330
x2,x3,x4,x5,x6,x7,x8,x9,x10,x11=330
y2,y3,y4,y5,y6,y7,y8,y9,y10,y11=330
x, y = 240, 120
position = [(180, 90), (180, 120), (210, 120), (x, y)]
......@@ -57,7 +58,7 @@ while True:
y += 30
position.append((x, y))
if x2==x and y2==y:
if x2 or x3 or x4 or x5 or x6 or x7 or x8 or x9 or x10 or x11==x and y2 or y3 or y4 or y5 or y6 or y7 or y8 or y9 or y10 or y11==y:
x2=random.randint(0,21)
y2=random.randint(0,15)
x2=x2*30
......@@ -74,6 +75,19 @@ while True:
# 将果实画上去
screen.blit(food, (x2, y2))
screen.blit(food, (x3, y2))
screen.blit(food, (x4, y2))
screen.blit(food, (x5, y2))
screen.blit(food, (x6, y2))
screen.blit(food, (x7, y2))
screen.blit(food, (x8, y2))
screen.blit(food, (x9, y2))
screen.blit(food, (x2, y2))
screen.blit(food, (x2, y2))
# 刷新画面
pygame.display.update()
FPSCLOCK.tick(4)
\ 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