Commit fa50ce17 by BellCodeEditor

save project

parent 945eeb29
Showing with 19 additions and 6 deletions
......@@ -42,6 +42,7 @@ aa=Block(bush,cacti,stone)
Block_list=pygame.sprite.Group()
time=0
b=0
gamestate=True
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -51,27 +52,34 @@ while True:
if jumpState == "runing":
if event.key == locals.K_SPACE:
jumpState = "up"
wukong = wu(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"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
wukong.rect.y=y
t += 2
else:
jumpState = "runing"
t =30
# 悟空造型
wukong = wu(hero[index])
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
index = 0
# wukong = wu(hero[index])
# if jumpState == "runing": # 跑步状态下
# index += 1
# if index >= 5:
# index = 0
#if aa.rect.x<=0-aa.rect.width:
#aa=Block(bush,cacti,stone)
#aa.rect.x-=8
......@@ -99,6 +107,7 @@ while True:
screen.blit(background, (shan_x,0))
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong.image, (wukong.rect.x,y)) # 悟空
......@@ -107,6 +116,10 @@ while True:
screen.blit(c.image, (c.rect.x, c.rect.y))
if c.rect.x<=0-c.rect.width:
c.kill()
if pygame.sprite.collide_rect(wukong,c):
gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate=False
......
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