From 1964a8102743c1bd2a0d6ba74bb830758787af42 Mon Sep 17 00:00:00 2001 From: Erenando Date: Wed, 29 Mar 2023 15:19:37 +0200 Subject: [PATCH] Jumping is now possible with spacebar --- project/data/sprites/sprites.json | 20 +++++++++++++++++++ project/level/elements/LoadedLevel.py | 5 ++++- .../elements/static/VacuumCleanerElement.py | 5 +++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/project/data/sprites/sprites.json b/project/data/sprites/sprites.json index f776452..a647f7f 100644 --- a/project/data/sprites/sprites.json +++ b/project/data/sprites/sprites.json @@ -128,6 +128,26 @@ } ] }, + {"id": "staubsauger", + "subsheets": [ + { + "id": "on", + "delays":[ + 1,1,1,1,1,1,1,1 + ], + "width": 48, + "height": 36 + }, + { + "id": "off", + "delays": [ + 20 + ], + "width": 48, + "height": 36 + } + ] + }, { "id": "temp_blocks", "subsheets": [ diff --git a/project/level/elements/LoadedLevel.py b/project/level/elements/LoadedLevel.py index 611ac21..36bb4a8 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.VacuumCleanerElement import VacuumCleanerElement from level.elements.static.GoalDoorReceiverLevelElement import GoalDoorReceiverLevelElement from level.elements.static.SpikeLevelElement import SpikeLevelElement from level.elements.static.ButtonInputLevelElement import ButtonInputLevelElement @@ -39,7 +40,9 @@ TILES = { 'S': SpikeLevelElement, 's': SpikeLevelElement, '<': SpikeLevelElement, - '>': SpikeLevelElement + '>': SpikeLevelElement, + + 'A': VacuumCleanerElement } diff --git a/project/level/elements/static/VacuumCleanerElement.py b/project/level/elements/static/VacuumCleanerElement.py index 33f31b5..b0dc97e 100644 --- a/project/level/elements/static/VacuumCleanerElement.py +++ b/project/level/elements/static/VacuumCleanerElement.py @@ -7,7 +7,7 @@ BLOCK_TYPES = { 'A': 'staubsauger' } -class SpikeLevelElement(StaticLevelElement): +class VacuumCleanerElement(StaticLevelElement): def __init__(self, tile: dict, loaded_level): super().__init__(tile, loaded_level) @@ -16,5 +16,6 @@ class SpikeLevelElement(StaticLevelElement): block_type = BLOCK_TYPES[self.tile['name']] self.spritesheet = spritesheet_manager.get_sheet(block_type) - self.set_animation_state('1') + + self.set_animation_state('on') self.position_scale.position = self.tile['position'] \ No newline at end of file