Commit 4624beba by BellCodeEditor

save project

parent 348b6974
Showing with 6 additions and 11 deletions
...@@ -31,7 +31,10 @@ index = 0 ...@@ -31,7 +31,10 @@ index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
bg_x = 0 bg_x = 0.
block_list =pygame.sprite.Group()
road_x = 0 road_x = 0
obstacle = random.choice([bush, stone, cacti]) obstacle = random.choice([bush, stone, cacti])
rect = obstacle.get_rect() rect = obstacle.get_rect()
...@@ -84,18 +87,11 @@ while True: ...@@ -84,18 +87,11 @@ while True:
screen.blit(road, (0, 500)) # 路 screen.blit(road, (0, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
obstacle = Ws(bush,cacti,stone)
for
if rect.x <= 0-rect.width: # 障碍物消失
# 创建障碍物对象
obstacle = random.choice([bush,stone,cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
screen.blit(obstacle, (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