Skip to content

Commit de870b4

Browse files
authored
Merge pull request #28 from Beefy-Swain/development
v1.3.0 Release
2 parents 9acda39 + 2ced9d4 commit de870b4

File tree

5 files changed

+37
-3
lines changed

5 files changed

+37
-3
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66

77
## [Unreleased]
88

9+
## [1.3.0] - 2021-03-31
10+
11+
- Added support for Parallax Scroll Factor on Layers. See https://doc.mapeditor.org/en/stable/manual/layers/#parallax-scrolling-factor
12+
13+
- Added support for Tint Colors on Layers. See https://doc.mapeditor.org/en/stable/manual/layers/#tinting-layers
14+
915
## [1.2.0] - 2021-02-21
1016

1117
### Changed

pytiled_parser/layer.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ class Layer:
5656
visible: bool
5757

5858
coordinates: OrderedPair = OrderedPair(0, 0)
59+
parallax_factor: OrderedPair = OrderedPair(1, 1)
5960

6061
id: Optional[int] = None
6162
size: Optional[Size] = None
6263
offset: Optional[OrderedPair] = None
6364
properties: Optional[properties_.Properties] = None
65+
tint_color: Optional[Color] = None
6466

6567

6668
TileLayerGrid = List[List[int]]
@@ -195,10 +197,13 @@ class RawLayer(TypedDict):
195197
objects: List[tiled_object.RawTiledObject]
196198
offsetx: float
197199
offsety: float
200+
parallaxx: float
201+
parallaxy: float
198202
opacity: float
199203
properties: List[properties_.RawProperty]
200204
startx: int
201205
starty: int
206+
tintcolor: str
202207
transparentcolor: str
203208
type: str
204209
visible: bool
@@ -350,6 +355,14 @@ def _get_common_attributes(raw_layer: RawLayer) -> Layer:
350355
if raw_layer.get("properties") is not None:
351356
common_attributes.properties = properties_.cast(raw_layer["properties"])
352357

358+
if raw_layer.get("parallaxx") is not None:
359+
common_attributes.parallax_factor = OrderedPair(
360+
raw_layer["parallaxx"], raw_layer["parallaxy"]
361+
)
362+
363+
if raw_layer.get("tintcolor") is not None:
364+
common_attributes.tint_color = parse_color(raw_layer["tintcolor"])
365+
353366
return common_attributes
354367

355368

pytiled_parser/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""pytiled_parser version"""
22

3-
__version__ = "1.2.0"
3+
__version__ = "1.3.0"

tests/test_data/layer_tests/all_layer_types/expected.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
id=1,
1111
size=common_types.Size(8, 6),
1212
offset=common_types.OrderedPair(1, 3),
13+
parallax_factor=common_types.OrderedPair(1.4, 1.3),
1314
properties={
1415
"test": "test property",
1516
},
17+
tint_color=common_types.Color(170, 255, 255, 255),
1618
data=[
1719
[
1820
1,
@@ -81,6 +83,8 @@
8183
opacity=1,
8284
visible=True,
8385
id=4,
86+
parallax_factor=common_types.OrderedPair(2.3, 1.2),
87+
tint_color=common_types.Color(0, 0, 255, 255),
8488
layers=[
8589
layer.ObjectLayer(
8690
name="Object Layer 1",
@@ -109,12 +113,14 @@
109113
id=3,
110114
image=Path("../../images/tile_04.png"),
111115
transparent_color=common_types.Color(0, 0, 0, 255),
116+
tint_color=common_types.Color(255, 0, 0, 255),
112117
),
113118
layer.ImageLayer(
114119
name="Image Layer 2",
115120
opacity=1,
116121
visible=True,
117122
id=5,
123+
parallax_factor=common_types.OrderedPair(1.5, 1.2),
118124
image=Path("../../images/tile_04.png"),
119125
),
120126
]

tests/test_data/layer_tests/all_layer_types/map.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,15 @@
1010
"offsetx":1,
1111
"offsety":3,
1212
"opacity":1,
13+
"parallaxx":1.4,
14+
"parallaxy":1.3,
1315
"properties":[
1416
{
1517
"name":"test",
1618
"type":"string",
1719
"value":"test property"
1820
}],
21+
"tintcolor":"#aaffff",
1922
"type":"tilelayer",
2023
"visible":true,
2124
"width":8,
@@ -49,6 +52,9 @@
4952
}],
5053
"name":"Group 1",
5154
"opacity":1,
55+
"parallaxx":2.3,
56+
"parallaxy":1.2,
57+
"tintcolor":"#0000ff",
5258
"type":"group",
5359
"visible":true,
5460
"x":0,
@@ -59,6 +65,7 @@
5965
"image":"..\/..\/images\/tile_04.png",
6066
"name":"Image Layer 1",
6167
"opacity":1,
68+
"tintcolor":"#ff0000",
6269
"transparentcolor":"#000000",
6370
"type":"imagelayer",
6471
"visible":true,
@@ -70,6 +77,8 @@
7077
"image":"..\/..\/images\/tile_04.png",
7178
"name":"Image Layer 2",
7279
"opacity":1,
80+
"parallaxx":1.5,
81+
"parallaxy":1.2,
7382
"type":"imagelayer",
7483
"visible":true,
7584
"x":0,
@@ -79,7 +88,7 @@
7988
"nextobjectid":3,
8089
"orientation":"orthogonal",
8190
"renderorder":"right-down",
82-
"tiledversion":"1.4.1",
91+
"tiledversion":"1.5.0",
8392
"tileheight":32,
8493
"tilesets":[
8594
{
@@ -88,6 +97,6 @@
8897
}],
8998
"tilewidth":32,
9099
"type":"map",
91-
"version":1.4,
100+
"version":1.5,
92101
"width":8
93102
}

0 commit comments

Comments
 (0)