Commit 0715de11 by BellCodeEditor

save project

parent 140e82cb
Showing with 8 additions and 12 deletions
...@@ -30,10 +30,8 @@ y = 400 ...@@ -30,10 +30,8 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
roud-x = 0 roud-x = 0
obstacle = random.choice([bush, stone, cacti]) obstacle = Block(bush,cacti,stone)
rect = obstacle.get_rect()
rect.x = 1000
rect.y = 500 - rect.height
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -75,14 +73,12 @@ while True: ...@@ -75,14 +73,12 @@ 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)) # 悟空
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if rect.x <= 0-rect.width: # 障碍物消失 if obstacle.rest.x <=0-obstacle.rest.width
# 创建障碍物对象 obstacle = Block(bush,cacti,stone)
obstacle = random.choice([bush,stone,cacti]) obstacle.rect.x -=8
rect = obstacle.get_rect() #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rect.x = 1000
rect.y = 500 - rect.height
rect.x -= 8
screen.blit(obstacle, (rect.x, rect.y) screen.blit(obstacle, (rect.x, rect.y)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
......
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