diff --git a/project/data/sprites/sprites.json b/project/data/sprites/sprites.json index 553a598..3388334 100644 --- a/project/data/sprites/sprites.json +++ b/project/data/sprites/sprites.json @@ -13,6 +13,19 @@ } ] }, + { + "id": "invisible", + "subsheets": [ + { + "id": "1", + "delays": [ + 1 + ], + "width": 12, + "height": 12 + } + ] + }, { "id": "goal_door", "subsheets": [ diff --git a/project/level/elements/LoadedLevel.py b/project/level/elements/LoadedLevel.py index 76d2685..7d6bc3b 100644 --- a/project/level/elements/LoadedLevel.py +++ b/project/level/elements/LoadedLevel.py @@ -3,6 +3,7 @@ from typing import Optional from level.Level import Level from level.elements.dynamic.BouncingBallLevelElement import BouncingBallLevelElement from level.elements.dynamic.PushableBoxLevelElement import PushableBoxLevelElement +from level.elements.static.InvisibleElement import InvisibleElement from level.elements.static.VacuumCleanerElement import VacuumCleanerElement from level.elements.static.GoalDoorReceiverLevelElement import GoalDoorReceiverLevelElement from level.elements.static.SpikeLevelElement import SpikeLevelElement @@ -42,7 +43,8 @@ TILES = { '<': SpikeLevelElement, '>': SpikeLevelElement, - 'A': VacuumCleanerElement + 'A': VacuumCleanerElement, + 'i': InvisibleElement } diff --git a/project/level/elements/static/InvisibleElement.py b/project/level/elements/static/InvisibleElement.py new file mode 100644 index 0000000..9a7a9ba --- /dev/null +++ b/project/level/elements/static/InvisibleElement.py @@ -0,0 +1,11 @@ +from level.Level import Level +from level.elements.static.StaticLevelElement import StaticLevelElement +from physics.SpriteManager import SpriteManager +from sprite.SpritesheetManager import SpritesheetManager + + +class InvisibleElement(StaticLevelElement): + def load(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, level: Level): + self.spritesheet = spritesheet_manager.get_sheet('invisible') + self.set_animation_state('1') + self.position_scale.position = self.tile['position'] diff --git a/project/level/elements/static/SimpleBlockLevelElement.py b/project/level/elements/static/SimpleBlockLevelElement.py index 5a75863..3e4da44 100644 --- a/project/level/elements/static/SimpleBlockLevelElement.py +++ b/project/level/elements/static/SimpleBlockLevelElement.py @@ -12,7 +12,8 @@ BLOCK_TYPES = { 'l': 'block_left', 'r': 'block_right', '~': 'block_top_left', - '|': 'block_top_right' + '|': 'block_top_right', + 'i': 'invisible' }