Commit fba9f4c2 by BellCodeEditor

save project

parent 6e3fd883
Showing with 10 additions and 12 deletions
...@@ -15,7 +15,7 @@ class Block(pygame.sprite.Sprite): ...@@ -15,7 +15,7 @@ class Block(pygame.sprite.Sprite):
self.rect.x = 1000 self.rect.x = 1000
self.rect.y = 500 - self.rect.height self.rect.y = 500 - self.rect.height
class Block(pygame.sprite.Sprite): class Player(pygame.sprite.Sprite):
def __init__(self,image): def __init__(self,image):
super().__init__() super().__init__()
...@@ -95,24 +95,22 @@ while True: ...@@ -95,24 +95,22 @@ while True:
if road_x<=-1000: if road_x<=-1000:
road_x = 0 road_x = 0
screen.blit(road, (road_x, 500)) screen.blit(road, (road_x, 500))
screen.blit(wukong, (150, y)) screen.blit(wukong.image, (150, y))
time += 1 time += 1
if time >= 60: if time >= 60:
time = 0 time = 0
r = random.randint(0,100) num = random.randint(0,50)
if r > 40: if num > 20:
abstacle = Block(bush,cacti,stone) abstacle = Block(bush,cacti,stone)
block_list.add(abstacle) block_list.add(abstacle)
time = 0 for sprite in block_list:
sprite.rect.x -= 8
for prop in block_list: screen.blit(sprite.image,(sprite.rect.x,sprite.rect.y))
prop.rect.x -= 8 if sprite.rect.x<=0-sprite.rect.width:
screen.blit(prop.image,(prop.rect.x,prop.rect.y)) sprite.kill()
if prop.rect.x<=0-prop.rect.width:
prop.kill()
if pygame.sprite.collide_rect(wukong,sprite): if pygame.sprite.collide_rect(wukong,sprite):
gameover = pygame.image.load('gameover.pog') gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200)) screen.blit(gameover,(400,200))
gamestate = False gamestate = False
......
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