Commit 73d76535 by BellCodeEditor

save project

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