2023-03-27 16:07:42 +02:00
|
|
|
from level.Level import Level
|
2023-03-27 18:37:30 +02:00
|
|
|
from level.elements.static.ReceiverLevelElement import ReceiverLevelElement
|
2023-03-27 16:07:42 +02:00
|
|
|
from physics.SpriteManager import SpriteManager
|
|
|
|
from sprite.SpritesheetManager import SpritesheetManager
|
|
|
|
|
|
|
|
|
|
|
|
class GateReceiverLevelElement(ReceiverLevelElement):
|
2023-03-29 15:40:15 +02:00
|
|
|
def __init__(self, tile: dict, level: Level, level_screen_manager: 'LevelScreenManager'):
|
|
|
|
super().__init__(tile, level, level_screen_manager)
|
2023-03-27 16:07:42 +02:00
|
|
|
|
|
|
|
def load(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, level: Level):
|
|
|
|
self.spritesheet = spritesheet_manager.get_sheet('gate')
|
|
|
|
self.set_animation_state('open' if self.active_state else 'close')
|
|
|
|
self.position_scale.position = self.tile['position']
|
|
|
|
|
|
|
|
def set_active(self, active: bool):
|
|
|
|
super().set_active(active)
|
|
|
|
self.set_animation_state('open' if self.active_state else 'close')
|
|
|
|
self.is_collider = not self.active_state
|
|
|
|
self.register_collisions = self.is_collider
|