Commit a49e1ab1 by BellCodeEditor

auto save

parent 95c38dc0
Showing with 8 additions and 2 deletions
...@@ -32,6 +32,7 @@ hero = [pygame.image.load('hero1.png'), ...@@ -32,6 +32,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'), pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'), pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')] pygame.image.load('hero5.png')]
lose = pygame.image.load('gameover.png')
lu_x=0 lu_x=0
shan_x=0 shan_x=0
index = 0 index = 0
...@@ -40,6 +41,7 @@ jumpState = "runing" ...@@ -40,6 +41,7 @@ jumpState = "runing"
t = 30 t = 30
time = 0 time = 0
s_list = pygame.sprite.Group() s_list = pygame.sprite.Group()
game_state = True
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:
...@@ -72,7 +74,7 @@ while True: ...@@ -72,7 +74,7 @@ while True:
jumpState = "runing" jumpState = "runing"
t =30 t =30
if game_state:
# 将背景图画上去 # 将背景图画上去
shan_x -=2 shan_x -=2
if shan_x <-1000: if shan_x <-1000:
...@@ -96,7 +98,10 @@ while True: ...@@ -96,7 +98,10 @@ while True:
i.kill() i.kill()
i.rect.x -= 8 i.rect.x -= 8
screen.blit(i.image, (i.rect.x, i.rect.y)) screen.blit(i.image, (i.rect.x, i.rect.y))
if pygame if pygame.sprite.collide_rect(wukong,i):
screen.blit(lose, (400, 300))
game_state = False
# 刷新画面 # 刷新画面
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