Commit 4f6f6282 by BellCodeEditor

save project

parent c9218bf4
Showing with 8 additions and 14 deletions
......@@ -33,10 +33,7 @@ t = 30
bg_x = 0 #背景x坐标
road_x = 0 #道路x坐标
# +++++++++++++++++++++++
obstacle = random.choice([bush, stone, cacti])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
obstacle=block(bush,cacti,stone)
while True:
for event in pygame.event.get():
......@@ -81,14 +78,11 @@ while True:
# +++++++++++++++++++++++
screen.blit(wukong, (150, y)) # 悟空
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))
if obstacle.rect.x<=0-obstacle.rect.width:
obstacle=block(bush,cacti,stone)
obstacle.rect.x-=8
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面
pygame.display.update()
FPS.tick(30)
\ No newline at end of file
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