Commit b01615b4 by BellCodeEditor

save project

parent 3ea21a03
Showing with 14 additions and 10 deletions
......@@ -32,6 +32,7 @@ t = 30
road_x=0
bg_x=0
obstacle = block.([bush, stone, cacti])
block_list=pygame.spri.group()
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -74,16 +75,18 @@ while True:
# 远处背景
screen.blit(road, (0, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
if obstacle. rect.x <= 0-bostacle.rect.width: # 障碍物消失
# 创建障碍物对象
obstacle = block.([bush,stone,cacti])
obstacle.rect.x-=8
screen.blit(obstacle,image, (obstacle,rect.x, rect.y))
time+=1
if time >=60:
r = random.randint(0,100)
if r >40:
obstacle=block(bush,cacti,stone)
block_list.add(obstacle)
time=0
for sprite in block_list:
sprite.rect.x-=8
screen.blit.x(sprite.image,(sprite,rect,x,prop.rect.y))
if sprite.rect.x<=0-sprite.rect.width
sprite.kill()
# 刷新画面
pygame.display.update()
FPS.tick(60)
\ 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