Commit c087d118 by BellCodeEditor

auto save

parent d11f9cb5
Showing with 12 additions and 4 deletions
......@@ -14,6 +14,7 @@ pygame.init() # 初始化
screen = pygame.display.set_mode((1000, 600))
FPS = pygame.time.Clock() # pygame时钟,控制游戏速度(帧数)
pygame.display.set_caption("悟空酷跑")
block_list = pygame.sprite.Group()
# 载入图片
background = pygame.image.load('bg.png') # 背景
road = pygame.image.load('road.png') # 路
......@@ -76,11 +77,18 @@ while True:
screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
if things.rect.x <= 0-things.rect.width: # 障碍物消失
# 创建障碍物对象
things = Block(bush,cacti,stone)
things.rect.x -= 8
# if things.rect.x <= 0-things.rect.width: # 障碍物消失
# # 创建障碍物对象
# things = Block(bush,cacti,stone)
# things.rect.x -= 8
block_list.add(things.image)
for i in block_list:
if things.rect.x < 0 - things.rect.width:
things.rect.x -= 8
screen.blit(things.image, (things.rect.x, things.rect.y))
# 刷新画面
......
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