Commit b49494b3 by BellCodeEditor

save project

parent b1b35771
Showing with 16 additions and 2 deletions
......@@ -33,7 +33,8 @@ y = 400
jumpState = "runing"
t = 30
aa=Block(bush,cacti,stone)
time=0
block_list=pygame.sprite.Group()
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -43,7 +44,7 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
if
if jumpState == "up": # 起跳状态
if t > 0:
y -= t
......@@ -80,6 +81,19 @@ if
aa=Block(bush,cacti,stone)
aa.rect.x -= 8
time+=1
if time>=60:
r=random.randint(0,100)
if r>40:
obstacle=Block(bush,cacti,stone)
block_list.add(obstacle)
time=0
for aa in block_list:
aa.rect.x-+8
screen.blit(aa.image,(aa.rect.x,aa.rect.y))
if aa.rect.x<=0-aa.rect.width:
aa.kill()
screen.blit(aa.image, (aa.rect.x, aa.rect.y))
# 刷新画面
......
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