tilemap-parser 3.1.2__tar.gz → 3.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/PKG-INFO +1 -1
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/pyproject.toml +1 -1
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/map_loader.py +1 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/renderer.py +5 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/tile_collision.py +120 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/PKG-INFO +1 -1
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/LICENSE +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/README.md +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/setup.cfg +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/__init__.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/parser/__init__.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/parser/animation.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/parser/collision.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/parser/collision_loader.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/parser/map_parse.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/__init__.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/animation_player.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/collision_cache.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/object_collision.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/utils/__init__.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/utils/geometry.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/SOURCES.txt +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/dependency_links.txt +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/requires.txt +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/top_level.txt +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_collision.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_geometry.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_map_loader.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_object_collision.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_render_scale.py +0 -0
- {tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/tests/test_tile_collision.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilemap-parser
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.4
|
|
4
4
|
Summary: Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime.
|
|
5
5
|
Author: tilemap parser contributors
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tilemap-parser"
|
|
7
|
-
version = "3.1.
|
|
7
|
+
version = "3.1.4"
|
|
8
8
|
description = "Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -34,6 +34,11 @@ class TileLayerRenderer:
|
|
|
34
34
|
raise ValueError(f"render_scale must be positive, got {self._rs}")
|
|
35
35
|
self._eff_w = int(self._tile_w * self._rs)
|
|
36
36
|
self._eff_h = int(self._tile_h * self._rs)
|
|
37
|
+
if self._eff_w <= 0 or self._eff_h <= 0:
|
|
38
|
+
raise ValueError(
|
|
39
|
+
f"effective tile size ({self._eff_w}, {self._eff_h}) must be positive; "
|
|
40
|
+
f"got tile_size=({self._tile_w}, {self._tile_h}) render_scale={self._rs}"
|
|
41
|
+
)
|
|
37
42
|
|
|
38
43
|
def get_layer_dict(self) -> Dict[int, object]:
|
|
39
44
|
return dict(self.tile_layers)
|
|
@@ -906,6 +906,126 @@ class CollisionRunner:
|
|
|
906
906
|
result.collided = result.hit_wall_x or collided_y
|
|
907
907
|
return result
|
|
908
908
|
|
|
909
|
+
def move_platformer_with_slide(
|
|
910
|
+
self,
|
|
911
|
+
sprite: ICollidableSprite,
|
|
912
|
+
tileset_collision: TilesetCollision,
|
|
913
|
+
tile_map: dict,
|
|
914
|
+
dt: float,
|
|
915
|
+
input_x: float = 0.0,
|
|
916
|
+
jump_pressed: bool = False,
|
|
917
|
+
max_iterations: int = 4,
|
|
918
|
+
) -> CollisionResult:
|
|
919
|
+
"""
|
|
920
|
+
Move sprite with platformer physics and combined slope-sliding collision.
|
|
921
|
+
|
|
922
|
+
Uses iterative normal projection for movement resolution instead of
|
|
923
|
+
separate X/Y sweeps. This allows smooth movement on slopes — walking
|
|
924
|
+
up a slope ascends the player, walking down follows the surface.
|
|
925
|
+
|
|
926
|
+
One-way platforms are treated as solid (same as move_and_slide).
|
|
927
|
+
Use move_platformer() if you need one-way pass-through from below.
|
|
928
|
+
|
|
929
|
+
Args:
|
|
930
|
+
sprite: Sprite to move (must have vx, vy, on_ground attributes)
|
|
931
|
+
tileset_collision: Tileset collision data
|
|
932
|
+
tile_map: Dictionary mapping (tile_x, tile_y) to tile_id
|
|
933
|
+
dt: Delta time in seconds
|
|
934
|
+
input_x: Horizontal input (-1 to 1)
|
|
935
|
+
jump_pressed: Whether jump button is pressed
|
|
936
|
+
max_iterations: Max slope-slide iterations (default 4)
|
|
937
|
+
|
|
938
|
+
Returns:
|
|
939
|
+
CollisionResult with final position and collision info
|
|
940
|
+
"""
|
|
941
|
+
result = self._result
|
|
942
|
+
result.collided = False
|
|
943
|
+
result.hit_wall_x = False
|
|
944
|
+
result.hit_wall_y = False
|
|
945
|
+
result.hit_ceiling = False
|
|
946
|
+
result.on_ground = False
|
|
947
|
+
result.slide_vector = None
|
|
948
|
+
result.final_x = sprite.x
|
|
949
|
+
result.final_y = sprite.y
|
|
950
|
+
|
|
951
|
+
if not getattr(sprite, "on_ground", False):
|
|
952
|
+
sprite.vy += self.gravity * dt
|
|
953
|
+
if sprite.vy > self.max_fall_speed:
|
|
954
|
+
sprite.vy = self.max_fall_speed
|
|
955
|
+
|
|
956
|
+
if jump_pressed and getattr(sprite, "on_ground", False):
|
|
957
|
+
sprite.vy = self.jump_strength
|
|
958
|
+
|
|
959
|
+
sprite.vx = input_x * 200.0
|
|
960
|
+
|
|
961
|
+
delta_x = sprite.vx * dt
|
|
962
|
+
delta_y = sprite.vy * dt
|
|
963
|
+
old_x, old_y = sprite.x, sprite.y
|
|
964
|
+
|
|
965
|
+
if delta_x == 0 and delta_y == 0:
|
|
966
|
+
return result
|
|
967
|
+
|
|
968
|
+
motion_x, motion_y = delta_x, delta_y
|
|
969
|
+
collided = False
|
|
970
|
+
|
|
971
|
+
for _ in range(max_iterations):
|
|
972
|
+
if abs(motion_x) < 0.01 and abs(motion_y) < 0.01:
|
|
973
|
+
break
|
|
974
|
+
|
|
975
|
+
sprite.x = old_x + motion_x
|
|
976
|
+
sprite.y = old_y + motion_y
|
|
977
|
+
|
|
978
|
+
hit = self._first_colliding_shape(sprite, tileset_collision, tile_map)
|
|
979
|
+
if hit is None:
|
|
980
|
+
break
|
|
981
|
+
|
|
982
|
+
sprite.x = old_x
|
|
983
|
+
sprite.y = old_y
|
|
984
|
+
collided = True
|
|
985
|
+
|
|
986
|
+
poly, ox, oy = hit
|
|
987
|
+
normal = self._get_collision_normal_from_motion(
|
|
988
|
+
sprite, poly, ox, oy, motion_x, motion_y, self.render_scale
|
|
989
|
+
)
|
|
990
|
+
if normal is None:
|
|
991
|
+
break
|
|
992
|
+
|
|
993
|
+
dot = motion_x * normal[0] + motion_y * normal[1]
|
|
994
|
+
if dot < 0:
|
|
995
|
+
motion_x -= normal[0] * dot
|
|
996
|
+
motion_y -= normal[1] * dot
|
|
997
|
+
else:
|
|
998
|
+
break
|
|
999
|
+
|
|
1000
|
+
result.final_x = sprite.x
|
|
1001
|
+
result.final_y = sprite.y
|
|
1002
|
+
result.collided = collided
|
|
1003
|
+
|
|
1004
|
+
if collided:
|
|
1005
|
+
if sprite.vy >= 0:
|
|
1006
|
+
sprite.y += 1.0
|
|
1007
|
+
if self._collides_at(sprite, tileset_collision, tile_map):
|
|
1008
|
+
result.on_ground = True
|
|
1009
|
+
sprite.on_ground = True
|
|
1010
|
+
sprite.vy = 0.0
|
|
1011
|
+
else:
|
|
1012
|
+
sprite.on_ground = False
|
|
1013
|
+
sprite.y -= 1.0
|
|
1014
|
+
|
|
1015
|
+
if sprite.vy < 0:
|
|
1016
|
+
sprite.y -= 1.0
|
|
1017
|
+
if self._collides_at(sprite, tileset_collision, tile_map):
|
|
1018
|
+
result.hit_ceiling = True
|
|
1019
|
+
sprite.vy = 0.0
|
|
1020
|
+
sprite.y += 1.0
|
|
1021
|
+
|
|
1022
|
+
if abs(result.final_x - old_x) < 0.01 and abs(delta_x) > 0.01:
|
|
1023
|
+
result.hit_wall_x = True
|
|
1024
|
+
else:
|
|
1025
|
+
sprite.on_ground = False
|
|
1026
|
+
|
|
1027
|
+
return result
|
|
1028
|
+
|
|
909
1029
|
def move_rpg(
|
|
910
1030
|
self,
|
|
911
1031
|
sprite: ICollidableSprite,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tilemap-parser
|
|
3
|
-
Version: 3.1.
|
|
3
|
+
Version: 3.1.4
|
|
4
4
|
Summary: Standalone parser/loader for tilemap-editor JSON maps, sprite animations, and collision detection runtime.
|
|
5
5
|
Author: tilemap parser contributors
|
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/animation_player.py
RENAMED
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser/runtime/object_collision.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tilemap_parser-3.1.2 → tilemap_parser-3.1.4}/src/tilemap_parser.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|