From 7d3dd16fe5c274cd5b8d4cf7e71d4eaafc9d3933 Mon Sep 17 00:00:00 2001 From: Yan Wittmann Date: Sun, 26 Mar 2023 11:21:22 +0200 Subject: [PATCH] Added structure for Level loading --- project/level/elements/BlockElement.py | 5 +++++ project/level/elements/LevelElement.py | 2 ++ project/level/elements/LoadedLevel.py | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 project/level/elements/BlockElement.py create mode 100644 project/level/elements/LevelElement.py create mode 100644 project/level/elements/LoadedLevel.py diff --git a/project/level/elements/BlockElement.py b/project/level/elements/BlockElement.py new file mode 100644 index 0000000..17dfc38 --- /dev/null +++ b/project/level/elements/BlockElement.py @@ -0,0 +1,5 @@ +from level.elements.LevelElement import LevelElement + + +class BlockElement(LevelElement): + pass diff --git a/project/level/elements/LevelElement.py b/project/level/elements/LevelElement.py new file mode 100644 index 0000000..522506d --- /dev/null +++ b/project/level/elements/LevelElement.py @@ -0,0 +1,2 @@ +class LevelElement: + pass diff --git a/project/level/elements/LoadedLevel.py b/project/level/elements/LoadedLevel.py new file mode 100644 index 0000000..8c95cd1 --- /dev/null +++ b/project/level/elements/LoadedLevel.py @@ -0,0 +1,23 @@ +from level.Level import Level +from physics.SpriteManager import SpriteManager, DrawLayers +from sprite.SpritesheetManager import SpritesheetManager +from sprite.StaticSprite import StaticSprite + +BLOCK_SIZE = (16, 16) + + +class LoadedLevel: + def __init__(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager): + self.sprite_manager = sprite_manager + self.spritesheet_manager = spritesheet_manager + + def load_level(self, level: Level): + for row in level.tiles: + for tile in row: + pass + + sprite = StaticSprite(self.spritesheet_manager.get_sheet('test_1')) + sprite.position_scale.position = (1, 1) + sprite.set_animation_state('idle') + + self.sprite_manager.add_ui_element(DrawLayers.OBJECTS, None)