Commit 73d76535 by BellCodeEditor

save project

parent b0150dc1
Showing with 9 additions and 14 deletions
......@@ -41,7 +41,7 @@ t=30
bg_x = 0
road_x = 0
time = 0
gamestate = True
gamestate=True
block_list = pygame.sprite.Group()
while True:
for event in pygame.event.get():
......@@ -51,17 +51,16 @@ while True:
if event.type == locals.KEYDOWN:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong = Player(hero[index])
if jumpState == "runing":
index += 1
if index >= 5:
index = 0
if gamestate== True:
jumpState = "up"
wukong = Player(hero[index])
if jumpState == "runing":
index += 1
if index >= 5:
index = 0
if gamestate == True:
if jumpState == "up" :
if t > 0:
y -=t
wukong.rect.y = y
t -=2
else:
jumpState = "down"
......@@ -69,12 +68,10 @@ while True:
if jumpState == "down":
if t <= 30:
y += t
wukong.rect.y = y
t += 2
else:
jumpState = "runing"
t=30
bg_x -= 1
if bg_x<=-1000:
bg_x = 0
......@@ -89,15 +86,14 @@ while True:
time += 1
if time >= 60:
time = 0
obstacle = Block(bush,cacti,stone)
block_list.add(obstacle)
time = 0
for prop in block_list:
prop.rect.x -= 8
screen.blit(prop.image,(prop.rect.x,prop.rect.y))
if prop.rect.x<=0-prop.rect.width:
prop.kill()
if pygame.sprite.coll
# 刷新画面
pygame.display.update()
FPS.tick(30)
\ 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