Skip to content

Commit

Permalink
refactor: landscape topleft standardization
Browse files Browse the repository at this point in the history
  • Loading branch information
u8slvn committed Aug 20, 2024
1 parent d49f0e0 commit e061f6c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Binary file modified src/doggo/assets/landscape/00_fg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions src/doggo/landscape.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from loguru import logger

from doggo import ASSETS_PATH
from doggo import config


class Biome(IntEnum):
Expand All @@ -31,7 +30,7 @@ class LandscapeLayer:

path = ASSETS_PATH.joinpath("landscape")

def __init__(self, topleft: tuple[int, int], image: str) -> None:
def __init__(self, image: str, topleft: tuple[int, int] = (0, 0)) -> None:
image_path = self.path.joinpath(image)
self.image = pg.image.load(image_path).convert_alpha()
self.rect = self.image.get_rect(topleft=topleft)
Expand All @@ -48,9 +47,5 @@ class Landscape:
fg_suffix = "_fg.png"

def __init__(self, biome: Biome) -> None:
self.background = LandscapeLayer(
topleft=(0, 0), image=f"{biome:02d}{self.bg_suffix}"
)
self.foreground = LandscapeLayer(
topleft=(0, config.WORLD_GROUND), image=f"{biome:02d}{self.fg_suffix}"
)
self.background = LandscapeLayer(image=f"{biome:02d}{self.bg_suffix}")
self.foreground = LandscapeLayer(image=f"{biome:02d}{self.fg_suffix}")

0 comments on commit e061f6c

Please sign in to comment.