Commit f65a321c by BellCodeEditor

save project

parent 91364c36
Showing with 10 additions and 8 deletions
......@@ -32,11 +32,11 @@ y = 400
jumpState = "runing"
t = 30
bg_x = 0
road_ = 0
road_x = 0
obstacle=random.choice([bush,cacti,stone])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.heiget
rect.y = 500 - rect.height
while True:
for event in pygame.event.get():
......@@ -83,20 +83,21 @@ while True:
road_x -= 8
if road_x<= -1000:
road_x=0
screen.blit(road,(road_x, 500)) # 悟空
screen.blit(road,(road_x, 500))
screen.blit(wukong,(150, y)) # 悟空
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
if rect.x <= 0-rect.width: # 障碍物消失
obstacle=random.choice([bush,cacti,stone])
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.heiget
rect.y = 500 - rect.height
# 创建障碍物对象
aa=Block(bush,cacti,stone)
aa.rect.x -= 8
rect.x -= 8
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
screen.blit(obstacle, (rect.x, rect.y))
# 刷新画面
pygame.display.update()
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