Commit ae8f73c0 by BellCodeEditor

save project

parent 1eb116a9
Showing with 12 additions and 2 deletions
......@@ -25,6 +25,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
s=pygame.sprite.Group()
z=0
lu_x=0
shan_x=0
index = 0
......@@ -40,7 +42,7 @@ while True:
exit()
if event.type == locals.KEYDOWN:
if jumpState == "runing":
if event.key == locals.K_SPACE:
if event.key == locals.K_SPACE or event.key == locals.K_w:
jumpState = "up"
if jumpState == "up": # 起跳状态
......@@ -73,10 +75,18 @@ while True:
lu_x=0
screen.blit(road, (lu_x, 500)) # 路
screen.blit(wukong, (150, y)) # 悟空
z+=1
if z>60:
z=0
j=random.randint(0,50)
if j>20:
aa=Block(bush,cacti,stone)
s.add(aa)
if aa.rect.x <= 0-aa.rect.width: # 障碍物消失
# 创建障碍物对象
aa=Block(bush,cacti,stone)
aa.kill()
aa.rect.x -= 8
......
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