Commit 8d3a2ce4 by BellCodeEditor

save project

parent 5c41971a
Showing with 5 additions and 5 deletions
......@@ -82,9 +82,9 @@ while True:
if obstacle.rect.x <= 0-obstacle.rect.width: # 障碍物消失
# 创建障碍物对象
obstacle = Block(bush, stone, cacti)
obstacle.rect = obstacle.get_rect()
obstacle.rect.x = 1000
obstacle.rect.y = 500 - obstacle.rect.height
#obstacle.rect = obstacle.get_rect()
#obstacle.rect.x = 1000
#obstacle.rect.y = 500 - obstacle.rect.height
obstacle.rect.x -= 8
screen.blit(obstacle.image, (obstacle.rect.x, obstacle.rect.y))
# 刷新画面
......
......@@ -20,8 +20,8 @@ hero = [pygame.image.load('hero1.png'),
pygame.image.load('hero4.png'),
pygame.image.load('hero5.png')]
class Block(pygame.sprite.Sprite):
def _init_(self,image1,image2,image3):
super()._init_()
def __init__(self,image1,image2,image3):
super().__init__()
self.image=random.choice([image1,image2,image3])
self.rect=self.image.get_rect()
self.rect.x=1000
......
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