countinued working on level loading
parent
34f3203c7a
commit
ef9b2d179f
|
@ -6,6 +6,7 @@ from level.elements.BlockElement import BlockElement
|
||||||
from level.elements.GateElement import GateElement
|
from level.elements.GateElement import GateElement
|
||||||
from level.elements.GoalDoorElement import GoalDoorElement
|
from level.elements.GoalDoorElement import GoalDoorElement
|
||||||
from level.elements.InteractableElement import InteractableElement
|
from level.elements.InteractableElement import InteractableElement
|
||||||
|
from level.elements.StaticLevelElement import StaticLevelElement
|
||||||
from physics.SpriteManager import SpriteManager, DrawLayers
|
from physics.SpriteManager import SpriteManager, DrawLayers
|
||||||
from sprite.SpritesheetManager import SpritesheetManager
|
from sprite.SpritesheetManager import SpritesheetManager
|
||||||
|
|
||||||
|
@ -19,8 +20,7 @@ class LoadedLevel:
|
||||||
self.blocks = []
|
self.blocks = []
|
||||||
|
|
||||||
def load_level(self, level: Level):
|
def load_level(self, level: Level):
|
||||||
requires_dict = {
|
requires_dict: dict[str, list[StaticLevelElement]] = {}
|
||||||
}
|
|
||||||
for row_number, row in enumerate(level.tiles):
|
for row_number, row in enumerate(level.tiles):
|
||||||
for tile_number, tile in enumerate(row):
|
for tile_number, tile in enumerate(row):
|
||||||
position = (tile_number * BLOCK_SIZE[0], row_number * BLOCK_SIZE[1])
|
position = (tile_number * BLOCK_SIZE[0], row_number * BLOCK_SIZE[1])
|
||||||
|
@ -57,7 +57,6 @@ class LoadedLevel:
|
||||||
sprite.set_animation_state('on')
|
sprite.set_animation_state('on')
|
||||||
sprite.position_scale.position = position
|
sprite.position_scale.position = position
|
||||||
|
|
||||||
|
|
||||||
# tile['id'], tile['requirements']
|
# tile['id'], tile['requirements']
|
||||||
|
|
||||||
if sprite is not None:
|
if sprite is not None:
|
||||||
|
@ -69,8 +68,6 @@ class LoadedLevel:
|
||||||
for requirement in requires_dict:
|
for requirement in requires_dict:
|
||||||
block.connect_element(requirement)
|
block.connect_element(requirement)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def destroy_level(self):
|
def destroy_level(self):
|
||||||
for block in self.blocks:
|
for block in self.blocks:
|
||||||
self.sprite_manager.remove_ui_element(block)
|
self.sprite_manager.remove_ui_element(block)
|
||||||
|
|
Loading…
Reference in New Issue