Commit c256a965 by BellCodeEditor

save project

parent 589f3328
Showing with 16 additions and 7 deletions
...@@ -30,6 +30,9 @@ y = 400 ...@@ -30,6 +30,9 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
roud-x = 0 roud-x = 0
bg_x=0
time=0
block_list = pygame.sprite.Group()
obstacle = Block(bush,cacti,stone) obstacle = Block(bush,cacti,stone)
...@@ -73,13 +76,18 @@ while True: ...@@ -73,13 +76,18 @@ while True:
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, (150, y)) # 悟空
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ time +=1
if obstacle.rest.x <=0-obstacle.rest.width if time >=60:
obstacle = Block(bush,cacti,stone) r= random.randint(0,100)
obstacle.rect.x -=8 if r > 40:
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ obstacle = Block(bush,cacti,stone)
block_list.add(obstacle)
screen.blit(obstacle, (rect.x, rect.y) time = 0
for prop in block_list:
prop.rect.x -=8
screen.bilt(sprite.image,(sprite.rect.x,prop.rect.y))
if prop.rect.x<=0-prop.rect.width
screen.blit, (rect.x, rect.y)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) 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