Commit 480699af by BellCodeEditor

save project

parent 5b0b4624
Showing with 12 additions and 6 deletions
......@@ -38,7 +38,7 @@ y = 400
jumpState = "runing"
t = 30
blocklist=pygame.sprite.Group()
time=0
dl=0
bj=0
while True:
......@@ -81,14 +81,19 @@ while True:
dl=0 # 远处背景
screen.blit(road, (dl, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
obstacle = Block(bush,stone,cacti)
blocklist.add(obstacle)
time+=1
if time>=60:
time=0
num=random.randint(0,50)
if num>30:
obstacle=Block(bush,stone,cacti)
blocklist.add(obstacle)
for i in blocklist:
i.rect.x-=8
screen.blit(i.image, (i.rect.x,i.rect.y))
screen.blit(obstacle.image, ( obstacle.rect.x, obstacle.rect.y))
if i.rect.x<0-i.rect.width:
i.kill()
# 刷新画面
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