Commit c4297a45 by BellCodeEditor

save project

parent 74246cd1
Showing with 5 additions and 1 deletions
...@@ -8,6 +8,7 @@ pygame.init() ...@@ -8,6 +8,7 @@ pygame.init()
screen = pygame.display.set_mode((660, 480)) screen = pygame.display.set_mode((660, 480))
FPSCLOCK = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数) FPSCLOCK = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
# 背景 # 背景
background = pygame.image.load('bg.png') background = pygame.image.load('bg.png')
right = pygame.image.load('right.png') # 头 朝右 right = pygame.image.load('right.png') # 头 朝右
...@@ -58,6 +59,9 @@ while True: ...@@ -58,6 +59,9 @@ while True:
n=random.randint(1,16) n=random.randint(1,16)
apple_x=30*m-30 apple_x=30*m-30
apple_y=30*n-30 apple_y=30*n-30
else: else:
position.pop(0) position.pop(0)
screen.blit(background, (0, 0)) screen.blit(background, (0, 0))
...@@ -67,7 +71,7 @@ while True: ...@@ -67,7 +71,7 @@ while True:
for i in range(len(position)-1): for i in range(len(position)-1):
screen.blit(body, position[i]) screen.blit(body, position[i])
# 将果实画上去 # 将果实画上
screen.blit(food, (apple_x, apple_y)) screen.blit(food, (apple_x, apple_y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
......
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