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,,,,,,,+,+,+,+,+,+,+,,,,,,,,#,#,#,#,#,#,#,#,#,,,,,,,
|
||||||
|
@ -43,4 +43,4 @@ AQ,18,requires_xor=lever-1;button-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
AU,32,requires_and=lever-1;button-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
AU,32,requires_and=lever-1;button-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
AJ,33,id=lever-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
AJ,33,id=lever-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
Q,34,id=button-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
Q,34,id=button-1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
||||||
F,23,size=7,,weight=0.5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
F,23,size=8,,weight=0.5,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
|
|
Binary file not shown.
After Width: | Height: | Size: 985 B |
|
@ -305,6 +305,97 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_bottom",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_left",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_right",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_top",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_top_left",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "cave_block_top_right",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 12,
|
||||||
|
"height": 12
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "ghost_character",
|
"id": "ghost_character",
|
||||||
"subsheets": [
|
"subsheets": [
|
||||||
|
@ -321,7 +412,7 @@
|
||||||
"width": 24,
|
"width": 24,
|
||||||
"height": 36
|
"height": 36
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "idle_l",
|
"id": "idle_l",
|
||||||
"delays": [
|
"delays": [
|
||||||
20,
|
20,
|
||||||
|
@ -382,6 +473,19 @@
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "debug_1",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "1",
|
||||||
|
"delays": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 24,
|
||||||
|
"height": 24
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "test_1",
|
"id": "test_1",
|
||||||
"subsheets": [
|
"subsheets": [
|
||||||
|
@ -430,5 +534,34 @@
|
||||||
"height": 16
|
"height": 16
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "staubsauger",
|
||||||
|
"subsheets": [
|
||||||
|
{
|
||||||
|
"id": "on",
|
||||||
|
"delays": [
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"width": 48,
|
||||||
|
"height": 36
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "off",
|
||||||
|
"delays": [
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"width": 48,
|
||||||
|
"height": 36
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -1,6 +1,7 @@
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from level.Level import Level
|
from level.Level import Level
|
||||||
|
from level.elements.dynamic.BouncingBallLevelElement import BouncingBallLevelElement
|
||||||
from level.elements.dynamic.PushableBoxLevelElement import PushableBoxLevelElement
|
from level.elements.dynamic.PushableBoxLevelElement import PushableBoxLevelElement
|
||||||
from level.elements.static.ButtonInputLevelElement import ButtonInputLevelElement
|
from level.elements.static.ButtonInputLevelElement import ButtonInputLevelElement
|
||||||
from level.elements.static.GateReceiverLevelElement import GateReceiverLevelElement
|
from level.elements.static.GateReceiverLevelElement import GateReceiverLevelElement
|
||||||
|
@ -27,6 +28,7 @@ TILES = {
|
||||||
'G': GateReceiverLevelElement,
|
'G': GateReceiverLevelElement,
|
||||||
|
|
||||||
'M': PushableBoxLevelElement,
|
'M': PushableBoxLevelElement,
|
||||||
|
'q': BouncingBallLevelElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
from level.Level import Level
|
||||||
|
from level.elements.dynamic.PushableLevelElement import PushableLevelElement
|
||||||
|
from physics.SpriteManager import SpriteManager
|
||||||
|
from sprite.SpritesheetManager import SpritesheetManager
|
||||||
|
|
||||||
|
|
||||||
|
class BouncingBallLevelElement(PushableLevelElement):
|
||||||
|
def __init__(self, tile: dict, loaded_level):
|
||||||
|
super().__init__(tile, loaded_level)
|
||||||
|
|
||||||
|
self.bounce_factor = -1
|
||||||
|
|
||||||
|
def load(self, sprite_manager: SpriteManager, spritesheet_manager: SpritesheetManager, level: Level):
|
||||||
|
self.spritesheet = spritesheet_manager.get_sheet('debug_1')
|
||||||
|
self.set_animation_state('1')
|
||||||
|
self.position_scale.position = self.tile['position']
|
||||||
|
self.position_scale.scale = (0.5, 0.5)
|
|
@ -18,7 +18,7 @@ from ui_elements.KeyManager import KeyManager
|
||||||
from ui_elements.LevelMenu import LevelMenu
|
from ui_elements.LevelMenu import LevelMenu
|
||||||
from ui_elements.TextLabel import TextLabel
|
from ui_elements.TextLabel import TextLabel
|
||||||
|
|
||||||
what_to_run = 'menu'
|
what_to_run = 'level'
|
||||||
|
|
||||||
|
|
||||||
def apply_frame_rate(number: float):
|
def apply_frame_rate(number: float):
|
||||||
|
@ -104,7 +104,7 @@ elif what_to_run == 'level':
|
||||||
parsed_levels_manager.load_from_config('data/levels/levels.json')
|
parsed_levels_manager.load_from_config('data/levels/levels.json')
|
||||||
|
|
||||||
generated_level = LoadedLevel(sprite_manager, spritesheet_manager)
|
generated_level = LoadedLevel(sprite_manager, spritesheet_manager)
|
||||||
generated_level.load_level(parsed_levels_manager.levels[0])
|
generated_level.load_level(parsed_levels_manager.levels[2])
|
||||||
ghost_character = PlayerSprite(spritesheet_manager.get_sheet("ghost_character"))
|
ghost_character = PlayerSprite(spritesheet_manager.get_sheet("ghost_character"))
|
||||||
ghost_character.position_scale = PositionScale((90, 50), (1, 1))
|
ghost_character.position_scale = PositionScale((90, 50), (1, 1))
|
||||||
sprite_manager.add_ui_element(DrawLayers.OBJECTS, ghost_character)
|
sprite_manager.add_ui_element(DrawLayers.OBJECTS, ghost_character)
|
||||||
|
|
|
@ -109,7 +109,7 @@ class PhysicsElementsHandler:
|
||||||
sprite.position_scale.position[1]
|
sprite.position_scale.position[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
sprite.motion = (0, sprite.motion[1])
|
sprite.motion = (sprite.motion[0] * sprite.bounce_factor, sprite.motion[1])
|
||||||
|
|
||||||
collides_with_last = collider
|
collides_with_last = collider
|
||||||
collided[0] = True
|
collided[0] = True
|
||||||
|
@ -153,14 +153,15 @@ class PhysicsElementsHandler:
|
||||||
sprite.position_scale.position[1] - motion_step[1]
|
sprite.position_scale.position[1] - motion_step[1]
|
||||||
)
|
)
|
||||||
|
|
||||||
sprite.motion = (sprite.motion[0], 0)
|
sprite.motion = (sprite.motion[0], sprite.motion[1] * sprite.bounce_factor)
|
||||||
|
|
||||||
collides_with_last = collider
|
collides_with_last = collider
|
||||||
collided[1] = True
|
collided[1] = True
|
||||||
|
|
||||||
return collides_with_last
|
return collides_with_last
|
||||||
|
|
||||||
def check_collides(self, sprite: StaticSprite, colliders: list[StaticSprite], screen_transform: PositionScale) -> list[StaticSprite]:
|
def check_collides(self, sprite: StaticSprite, colliders: list[StaticSprite], screen_transform: PositionScale) -> \
|
||||||
|
list[StaticSprite]:
|
||||||
collides_with = []
|
collides_with = []
|
||||||
|
|
||||||
for collider in colliders:
|
for collider in colliders:
|
||||||
|
@ -171,7 +172,7 @@ class PhysicsElementsHandler:
|
||||||
continue
|
continue
|
||||||
if sprite.collides_with(collider, TOLERANCE):
|
if sprite.collides_with(collider, TOLERANCE):
|
||||||
collides_with.append(collider)
|
collides_with.append(collider)
|
||||||
if len(collides_with) >= 2:
|
if len(collides_with) > 5:
|
||||||
break
|
break
|
||||||
|
|
||||||
return collides_with
|
return collides_with
|
||||||
|
|
|
@ -17,6 +17,8 @@ class DynamicSprite(StaticSprite):
|
||||||
self.deceleration_horizontal_ground = 0.3
|
self.deceleration_horizontal_ground = 0.3
|
||||||
self.gravity = 9.81 / 10
|
self.gravity = 9.81 / 10
|
||||||
|
|
||||||
|
self.bounce_factor = 0
|
||||||
|
|
||||||
def tick(self, tick_data: TickData):
|
def tick(self, tick_data: TickData):
|
||||||
super().tick(tick_data)
|
super().tick(tick_data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue