Commit 12e13784 by BellCodeEditor

save project

parent 33eacb91
...@@ -20,6 +20,8 @@ hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.ima ...@@ -20,6 +20,8 @@ hero = [pygame.image.load('hero1.png'),pygame.image.load('hero2.png'),pygame.ima
pygame.image.load('hero4.png'),pygame.image.load('hero5.png')] pygame.image.load('hero4.png'),pygame.image.load('hero5.png')]
gameover=pygame.image.load('gameover.png') gameover=pygame.image.load('gameover.png')
index = 0 index = 0
defen=0
ziti = pygame.font.Font('ziti.ttf',20)
y=400 y=400
class Block(pygame.sprite.Sprite): class Block(pygame.sprite.Sprite):
def __init__(self,imag1,image2,image3): def __init__(self,imag1,image2,image3):
...@@ -79,10 +81,13 @@ while True: ...@@ -79,10 +81,13 @@ while True:
t+=2 t+=2
else: else:
zt='run' zt='run'
defen+=1
# 将背景图画上去 # 将背景图画上去
screen.blit(background, (bg_x, 0)) screen.blit(background, (bg_x, 0))
screen.blit(road, (road_x, 500)) screen.blit(road, (road_x, 500))
text = ziti.render('得分:'+str(defen),True,(0,0,0))
screen.blit(text,(850,10))
screen.blit(wukong.image, (150, y)) screen.blit(wukong.image, (150, y))
if zt=='run': if zt=='run':
index=(index+1) % len(hero) index=(index+1) % len(hero)
......
File added
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