Commit b14a780d by BellCodeEditor

save project

parent 3c84f352
Showing with 9 additions and 2 deletions
......@@ -32,6 +32,7 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
lose=pygame.image.load('gameover.png')
lu_x=0
shan_x=0
index = 0
......@@ -40,6 +41,7 @@ jumpState = "runing"
t = 30
time=0
s_list=pygame.sprite.Group()
game_state=True
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -54,7 +56,7 @@ while True:
index += 1
if index >= 5:
index = 0
screen.blit(wukong.image, (150, wukong.rect.y))
if jumpState == "up": # 起跳状态
if t > 0:
......@@ -75,6 +77,7 @@ while True:
# 悟空造型
# 将背景图画上去
if game_state:
shan_x -=2
if shan_x <-1000:
shan_x=0
......@@ -84,7 +87,7 @@ while True:
lu_x=0
screen.blit(road, (lu_x, 500)) # 路
# 悟空
screen.blit(wukong.image, (150, wukong.rect.y))
time+=1
if time>60:
......@@ -98,6 +101,9 @@ while True:
i.kill()
i.rect.x -= 8
screen.blit(i.image, (i.rect.x, i.rect.y))
if pygame.sprite.collide_rect(wukong,i):
screen.blit(lose, (400, 300))
game_state=False
# 刷新画面
pygame.display.update()
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