Commit 2503ba61 by BellCodeEditor

save project

parent fb68ac66
Showing with 11 additions and 10 deletions
...@@ -31,9 +31,8 @@ index = 0 ...@@ -31,9 +31,8 @@ index = 0
y = 400 y = 400
jumpState = "runing" jumpState = "runing"
t = 60 t = 60
aa=Block(bush,cacti,stone)
time=0 time=0
bl=pyagme.sprite.Group() bl=pygame.sprite.Group()
while True: while True:
for event in pygame.event.get(): for event in pygame.event.get():
if event.type == locals.QUIT: if event.type == locals.QUIT:
...@@ -69,7 +68,7 @@ while True: ...@@ -69,7 +68,7 @@ while True:
if shan_x <-1000: if shan_x <-1000:
shan_x=0 shan_x=0
screen.blit(background, (shan_x, 0)) # 远处背景 screen.blit(background, (shan_x, 0)) # 远处背景
lu_x -=23 lu_x -=1
if lu_x <-1000: if lu_x <-1000:
lu_x=0 lu_x=0
screen.blit(road, (lu_x, 500)) # 路 screen.blit(road, (lu_x, 500)) # 路
...@@ -79,14 +78,16 @@ while True: ...@@ -79,14 +78,16 @@ while True:
time=0 time=0
num=random.randint(0,50) num=random.randint(0,50)
if num>20: if num>20:
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# 创建障碍物对象
aa=Block(bush,cacti,stone) aa=Block(bush,cacti,stone)
aa.rect.x -= 23 bl.add(aa)
for i in bl:
i.rect.x -=8
screen.blit(aa.image, (i.rect.x, i.rect.y))
if i.rect.x <= 0-i.rect.width:
i.kill()
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(128) FPS.tick(60)
\ No newline at end of file \ 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