diff --git a/pygame-wasm/phantomcastle/game/coins.py b/pygame-wasm/phantomcastle/game/coins.py index f61fa14..f1ac55e 100644 --- a/pygame-wasm/phantomcastle/game/coins.py +++ b/pygame-wasm/phantomcastle/game/coins.py @@ -15,7 +15,7 @@ class Coin(DrawableGameObject): assets: dict | None = None, ): 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.topleft = coords # уменьшаем размер монетки diff --git a/pygame-wasm/phantomcastle/game/endlevelmenu.py b/pygame-wasm/phantomcastle/game/endlevelmenu.py index 1191b2e..d67a576 100644 --- a/pygame-wasm/phantomcastle/game/endlevelmenu.py +++ b/pygame-wasm/phantomcastle/game/endlevelmenu.py @@ -46,7 +46,7 @@ class EndLevelMenu(DrawableGameObject, EventHandler): 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.center = self.parent.rect.center return SurfaceWithRect(surface, rect) diff --git a/pygame-wasm/phantomcastle/game/hero.py b/pygame-wasm/phantomcastle/game/hero.py index 128818d..780f525 100644 --- a/pygame-wasm/phantomcastle/game/hero.py +++ b/pygame-wasm/phantomcastle/game/hero.py @@ -28,7 +28,7 @@ class Hero(DrawableGameObject, EventHandler): assets: dict | None = None, ): 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() sf = Coords(0.8, 0.8) self._surface, self.rect = self.scene.scale_box(self.surface, self.rect, sf) diff --git a/pygame-wasm/phantomcastle/game/scene.py b/pygame-wasm/phantomcastle/game/scene.py index 3b0b6fc..5133a05 100644 --- a/pygame-wasm/phantomcastle/game/scene.py +++ b/pygame-wasm/phantomcastle/game/scene.py @@ -34,7 +34,7 @@ class Scene(DrawableGameObject, EventHandler): self._surface = pygame.display.set_mode(screen_sz) self.surface.fill("white") 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) double_bg = pygame.Surface((screen_sz.x * 2, screen_sz.y)) @@ -83,7 +83,6 @@ class Scene(DrawableGameObject, EventHandler): def draw(self): if self.done: return - self.surface.fill("white") self.surface.blit(self.background, (-self.bg_shift, 0)) if self.level_completed: self.end.draw() diff --git a/pygame-wasm/phantomcastle/game/wall.py b/pygame-wasm/phantomcastle/game/wall.py index e4befad..bdf542d 100644 --- a/pygame-wasm/phantomcastle/game/wall.py +++ b/pygame-wasm/phantomcastle/game/wall.py @@ -13,7 +13,7 @@ class WallBlock(DrawableGameObject): assets: dict | None = None, ): 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.topleft = coords # уменьшаем размер монетки