Commit df188319 by BellCodeEditor

save project

parent 3dfdadcb
Showing with 7 additions and 5 deletions
......@@ -11,7 +11,7 @@ class Block(pygame.sprite.Sprite):
self.rect=self.image.get_rect()
self.rect.x=1000
self.rect.y=500-self.rect.height
self.score=1
class Player(pygame.sprite.Sprite):
def __init__(self,image):
super().__init__()
......@@ -43,6 +43,7 @@ road_x=0
ba_x=0
time=0
gamestate=True
score=0
while True:
for event in pygame.event.get():
if event.type == locals.QUIT:
......@@ -106,10 +107,11 @@ while True:
gameover=pygame.image.load('gameover.png')
screen.blit(gameover,(400,200))
gamestate=False
# if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# # 创建障碍物对象
# obstacle =Block(bush, stone, cacti)
# obstacle.rect.x -= 8
else:
if i.rect.x+i.rect.width<wukong.rect.x:
score+=i.score
i.score=0
print(score)
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面
......
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