Commit 65606ab0 by BellCodeEditor

save project

parent 47cea834
Showing with 7 additions and 6 deletions
......@@ -9,7 +9,7 @@ class Block(pygame.sprite.Sprite):
self.rect=self.image.get_rect()
self.rect.x=1000
self.rect.y=500-self.rect.height
class p(pygame.sprite.Sprite):
class P(pygame.sprite.Sprite):
def __init__(self,image):
super().__init__()
self.image=image
......@@ -42,6 +42,7 @@ t = 30
#aa=Block(bush,cacti,stone)
block_list=pygame.sprite.Group()
time=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -62,14 +63,14 @@ while True:
if jumpState == "down": # 降落状态
if t <= 30:
y += t
p.image.rect.y=y
image.rect.y=y
t += 2
else:
jumpState = "runing"
t =30
# 悟空造型
wukong = hero[index]
wukong = P(hero[index])
if jumpState == "runing": # 跑步状态下
index += 1
if index >= 5:
......@@ -83,7 +84,7 @@ while True:
if lu_x <-1000:
lu_x=0
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
screen.blit(wukong.image, (150, y)) # 悟空
#if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# 创建障碍物对象
......@@ -101,8 +102,8 @@ while True:
if prop.rect.x<=0-prop.rect.width:
prop.kill()
if pygame.sprite.collide_rect(wukong,prop):
o=pygame.image.load("gamemover.png")
screen.blit(gameover(500,300))
gameover=pygame.image.load("gamemover.png")
screen.blit(gameover,(500,300))
gs=False
# 刷新画面
pygame.display.update()
......
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