Commit 802557f3 by BellCodeEditor

save project

parent a85da778
Showing with 11 additions and 3 deletions
...@@ -33,8 +33,8 @@ y = 400 ...@@ -33,8 +33,8 @@ y = 400
jumpState = "runing" jumpState = "runing"
t = 30 t = 30
aa=Block(bush,stone,cacti) aa=Block(bush,stone,cacti)
block_list = pygame.sprite.Group() block_list = pygame.sprite.Group()
time = 0
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
...@@ -83,11 +83,18 @@ while True: ...@@ -83,11 +83,18 @@ while True:
screen.blit(road, (road_x, 500)) # 路 screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空 screen.blit(wukong, (150, y)) # 悟空
obstacle = Block(bush,cacti,stone) time += 1
block_list.add(obstacle) if time >= 60:
time = 0
num = random.randint(0,50)
if num > 20:
obstacle = Block(bush,cacti,stone)
block_list.add(obstacle)
for aa in block_list: for aa in block_list:
aa.rect.x -= 8 aa.rect.x -= 8
screen.blit(aa.image, (aa.rect.x, aa.rect.y)) screen.blit(aa.image, (aa.rect.x, aa.rect.y))
if aa.rect.x <= 0-aa.rect.width:
aa.kill()
# 刷新画面 # 刷新画面
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