Commit 8ff09202 by BellCodeEditor

save project

parent 96060123
Showing with 17 additions and 5 deletions
...@@ -32,7 +32,9 @@ wukong_y=400 ...@@ -32,7 +32,9 @@ wukong_y=400
rode_x=0 rode_x=0
background_x=0 background_x=0
t=30 t=30
obstacle = Block(bush,cacti,stone) time=0
block_list = pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -73,11 +75,21 @@ while True: ...@@ -73,11 +75,21 @@ while True:
screen.blit(road, (rode_x, 500)) screen.blit(road, (rode_x, 500))
screen.blit(wukong, (150, wukong_y)) screen.blit(wukong, (150, wukong_y))
if obstacle.rect.x<=0-obstacle.rect.width: #if obstacle.rect.x<=0-obstacle.rect.width:
obstacle = Block(bush,cacti,stone) # obstacle = Block(bush,cacti,stone)
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y)) time += 1
obstacle.rect.x -= 8 if time >=60:
r = random.randint(0,100)
if r>40:
obstacle = Block(bush,cacti,stone)
block_list.add(obstacle)
time = 0
for prop in block_list:
prop.rect.x-=8
screen.blit(prop.image, (prop.rect.x, prop.rect.y))
if prop.rect.x<=0-prop.rect.width:
prop.kill()
rode_x=rode_x-8 rode_x=rode_x-8
background_x -= 5 background_x -= 5
# 刷新画面 # 刷新画面
......
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