phantomcastle: always convert_alpha
This commit is contained in:
parent
087886955d
commit
a09dfebaa8
@ -15,7 +15,7 @@ class Coin(DrawableGameObject):
|
|||||||
assets: dict | None = None,
|
assets: dict | None = None,
|
||||||
):
|
):
|
||||||
super().__init__(coords, parent, assets)
|
super().__init__(coords, parent, assets)
|
||||||
self._surface = pygame.image.load(self.assets["coin.png"])
|
self._surface = pygame.image.load(self.assets["coin.png"]).convert_alpha()
|
||||||
self.rect = self.surface.get_rect()
|
self.rect = self.surface.get_rect()
|
||||||
self.rect.topleft = coords
|
self.rect.topleft = coords
|
||||||
# уменьшаем размер монетки
|
# уменьшаем размер монетки
|
||||||
|
@ -46,7 +46,7 @@ class EndLevelMenu(DrawableGameObject, EventHandler):
|
|||||||
|
|
||||||
def _create_win_image(self) -> SurfaceWithRect:
|
def _create_win_image(self) -> SurfaceWithRect:
|
||||||
"""Картинка для хорошего финала"""
|
"""Картинка для хорошего финала"""
|
||||||
surface = pygame.image.load(self.scene.assets["win.png"])
|
surface = pygame.image.load(self.scene.assets["win.png"]).convert_alpha()
|
||||||
rect = surface.get_rect()
|
rect = surface.get_rect()
|
||||||
rect.center = self.parent.rect.center
|
rect.center = self.parent.rect.center
|
||||||
return SurfaceWithRect(surface, rect)
|
return SurfaceWithRect(surface, rect)
|
||||||
|
@ -28,7 +28,7 @@ class Hero(DrawableGameObject, EventHandler):
|
|||||||
assets: dict | None = None,
|
assets: dict | None = None,
|
||||||
):
|
):
|
||||||
super().__init__(coords, parent, assets)
|
super().__init__(coords, parent, assets)
|
||||||
self._surface = pygame.image.load(self.assets["ghost.png"])
|
self._surface = pygame.image.load(self.assets["ghost.png"]).convert_alpha()
|
||||||
self.rect = self.surface.get_rect()
|
self.rect = self.surface.get_rect()
|
||||||
sf = Coords(0.8, 0.8)
|
sf = Coords(0.8, 0.8)
|
||||||
self._surface, self.rect = self.scene.scale_box(self.surface, self.rect, sf)
|
self._surface, self.rect = self.scene.scale_box(self.surface, self.rect, sf)
|
||||||
|
@ -34,7 +34,7 @@ class Scene(DrawableGameObject, EventHandler):
|
|||||||
self._surface = pygame.display.set_mode(screen_sz)
|
self._surface = pygame.display.set_mode(screen_sz)
|
||||||
self.surface.fill("white")
|
self.surface.fill("white")
|
||||||
self.rect = self.surface.get_rect()
|
self.rect = self.surface.get_rect()
|
||||||
self.background = pygame.image.load(self.assets["bg1k.png"])
|
self.background = pygame.image.load(self.assets["bg1k.png"]).convert_alpha()
|
||||||
self.background = pygame.transform.scale(self.background, self.rect.size)
|
self.background = pygame.transform.scale(self.background, self.rect.size)
|
||||||
|
|
||||||
double_bg = pygame.Surface((screen_sz.x * 2, screen_sz.y))
|
double_bg = pygame.Surface((screen_sz.x * 2, screen_sz.y))
|
||||||
@ -83,7 +83,6 @@ class Scene(DrawableGameObject, EventHandler):
|
|||||||
def draw(self):
|
def draw(self):
|
||||||
if self.done:
|
if self.done:
|
||||||
return
|
return
|
||||||
self.surface.fill("white")
|
|
||||||
self.surface.blit(self.background, (-self.bg_shift, 0))
|
self.surface.blit(self.background, (-self.bg_shift, 0))
|
||||||
if self.level_completed:
|
if self.level_completed:
|
||||||
self.end.draw()
|
self.end.draw()
|
||||||
|
@ -13,7 +13,7 @@ class WallBlock(DrawableGameObject):
|
|||||||
assets: dict | None = None,
|
assets: dict | None = None,
|
||||||
):
|
):
|
||||||
super().__init__(coords, parent, assets)
|
super().__init__(coords, parent, assets)
|
||||||
self._surface = pygame.image.load(self.assets["brick.png"])
|
self._surface = pygame.image.load(self.assets["brick.png"]).convert_alpha()
|
||||||
self.rect = self.surface.get_rect()
|
self.rect = self.surface.get_rect()
|
||||||
self.rect.topleft = coords
|
self.rect.topleft = coords
|
||||||
# уменьшаем размер монетки
|
# уменьшаем размер монетки
|
||||||
|
Loading…
Reference in New Issue
Block a user