示例#1
0
 def load_image(self, path=0):
     #if not path:
     #    path = self.image_path
     #try:
     #    return pygame.image.load(path).convert_alpha()
     #except:
     image = pygame.Surface((25, 25))
     image.fill(colours.random_color())
     return image
示例#2
0
 def __init__(self, image_path, walkable=True, tile_id=1):
     super().__init__()
     try:
         self.image = pygame.image.load(image_path).convert()
     except pygame.error:
         self.image = pygame.Surface((50, 50))
         self.image.fill(colours.random_color())
     self.rect = self.image.get_rect()
     self.tile_id = tile_id
     self.walkable =walkable