import random from level.Level import Level from level.elements.StaticLevelElement import StaticLevelElement from physics.SpriteManager import SpriteManager from sprite.SpritesheetManager import SpritesheetManager BLOCK_TYPES = { '#': 'block_full' } class SimpleBlockLevelElement(StaticLevelElement): def __init__(self, tile: dict, loaded_level): super().__init__(tile, loaded_level) def load(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, level: Level): name = self.tile['name'] position = self.tile['position'] block_type = BLOCK_TYPES[name] self.spritesheet = spritesheet_manager.get_sheet(level.theme + '_' + block_type) self.set_animation_state(str(random.randint(1, 3))) self.position_scale.position = position