Commit 1cf203c3 by BellCodeEditor

save project

parent eaa9bc00
Showing with 2 additions and 8 deletions
...@@ -50,7 +50,6 @@ while True: ...@@ -50,7 +50,6 @@ while True:
if jumpState == "runing": if jumpState == "runing":
if event.key == locals.K_SPACE: if event.key == locals.K_SPACE:
jumpState = "up" jumpState = "up"
if gamestate==True: if gamestate==True:
# 悟空造型 # 悟空造型
wukong = Player(hero[index]) wukong = Player(hero[index])
...@@ -82,10 +81,10 @@ while True: ...@@ -82,10 +81,10 @@ while True:
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (background_x, 0)) # 远处背景 screen.blit(background, (background_x, 0)) # 远处背景
screen.blit(road, (road_x, 500)) # 路 screen.blit(road, (road_x, 500)) # 路
screen.blit(wukong.image, (150, y)) # 悟空 screen.blit(wukong.image, (200, wukong.rect.y)) # 悟空
time+=1 time+=1
if time>=60: if time>=60:
num=random.randint(0,100) num=random.randint(0,50)
if num>40: if num>40:
obstacle=Block(bush,cacti,stone) obstacle=Block(bush,cacti,stone)
block_list.add(obstacle) block_list.add(obstacle)
...@@ -95,14 +94,10 @@ while True: ...@@ -95,14 +94,10 @@ while True:
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()
print(prop.rect.x)
if pygame.sprite.collide_rect(wukong,prop): if pygame.sprite.collide_rect(wukong,prop):
gameover = pygame.image.load('gameover.png') gameover = pygame.image.load('gameover.png')
screen.blit(gameover,(400,200)) screen.blit(gameover,(400,200))
gamestate=False gamestate=False
print(wukong.rect.x)
# 刷新画面 # 刷新画面
pygame.display.update() pygame.display.update()
FPS.tick(60) 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