Commit da3d6d1d by BellCodeEditor

save project

parent 4882ebc8
Showing with 6 additions and 5 deletions
......@@ -39,8 +39,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero2.png'),
pygame.image.load('hero3.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
basic_font = pygame.font.Font(32)
pygame.image.load('hero5.png') ]
basic_font = pygame.font.Font(None,32)
index = 0
y = 400
jumpState = "runing"
......@@ -49,7 +49,7 @@ road_x = 0
bg_x = 0
time = 0
gamestate = True
score=0
block_list =pygame.sprite.Group() # 创建精灵组
while True:
......@@ -74,14 +74,14 @@ while True:
if t > 0:
y -= t
wukong.rect.y = y
t -= 2
t -= 1
else:
jumpState = "down"
if jumpState == "down": # 降落状态
if t <= 30:
y += t
wukong.rect.y = y
t += 2
t += 1
else:
jumpState = "runing"
t =30
......@@ -110,6 +110,7 @@ while True:
sprite.rect.x -= 8
screen.blit(sprite.image, (sprite.rect.x, sprite.rect.y))
if sprite.rect.x <= 0-sprite.rect.width:
score+=1
sprite.kill()
if pygame.sprite.collide_rect(wukong, sprite): # 精灵碰撞检测
gameover = pygame.image.load('gameover.png') # 游戏结束
......
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