Commit 5b0b4624 by BellCodeEditor

save project

parent 7eaf3b82
Showing with 7 additions and 7 deletions
...@@ -37,8 +37,7 @@ index = 0 ...@@ -37,8 +37,7 @@ index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
obstacle=Block(bush,stone,cacti) blocklist=pygame.sprite.Group()
dl=0 dl=0
bj=0 bj=0
...@@ -83,11 +82,12 @@ while True: ...@@ -83,11 +82,12 @@ while True:
screen.blit(road, (dl, 500)) # 路 screen.blit(road, (dl, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
if obstacle.rect.x <= 0- obstacle.rect.width: # 障碍物消失 obstacle = Block(bush,stone,cacti)
# 创建障碍物对象 blocklist.add(obstacle)
obstacle = Block(bush,stone,cacti) for i in blocklist:
i.rect.x-=8
obstacle.rect.x -= 8 screen.blit(i.image, (i.rect.x,i.rect.y))
screen.blit(obstacle.image, ( obstacle.rect.x, obstacle.rect.y)) screen.blit(obstacle.image, ( obstacle.rect.x, obstacle.rect.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