Skip to content

Commit 7287222

Browse files
authored
Merge pull request #46 from benjamin-kirkbride/development
Merge Development for v1.5.4
2 parents 885422d + 464454b commit 7287222

File tree

5 files changed

+19
-10
lines changed

5 files changed

+19
-10
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.5.4] - 2021-10-12
10+
11+
Previously if only one parallax value(x or y) on a layer had been set, it would fail because pytiled-parser was assuming that if one was set then the other would be. This is not actually the case in the Tiled map file.
12+
13+
The value for them now defaults to 1.0 if it is not specified in the map file(This is the Tiled default value).
14+
915
## [1.5.3] - 2021-08-28
1016

1117
Just a small bugfix in this release. Previously if a layer's offset was (0, 0), the values for it would not appear in the JSON file, so the `offset` value in the

pytiled_parser/layer.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,15 @@ def _get_common_attributes(raw_layer: RawLayer) -> Layer:
356356
if raw_layer.get("properties") is not None:
357357
common_attributes.properties = properties_.cast(raw_layer["properties"])
358358

359+
parallax = [1.0, 1.0]
360+
359361
if raw_layer.get("parallaxx") is not None:
360-
common_attributes.parallax_factor = OrderedPair(
361-
raw_layer["parallaxx"], raw_layer["parallaxy"]
362-
)
362+
parallax[0] = raw_layer["parallaxx"]
363+
364+
if raw_layer.get("parallaxy") is not None:
365+
parallax[1] = raw_layer["parallaxy"]
366+
367+
common_attributes.parallax_factor = OrderedPair(parallax[0], parallax[1])
363368

364369
if raw_layer.get("tintcolor") is not None:
365370
common_attributes.tint_color = parse_color(raw_layer["tintcolor"])

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.5.3"
3+
__version__ = "1.5.4"

tests/test_data/layer_tests/all_layer_types/expected.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
opacity=1,
8484
visible=True,
8585
id=4,
86-
parallax_factor=common_types.OrderedPair(2.3, 1.2),
86+
parallax_factor=common_types.OrderedPair(1.4, 1.0),
8787
tint_color=common_types.Color(0, 0, 255, 255),
8888
layers=[
8989
layer.ObjectLayer(
@@ -122,7 +122,7 @@
122122
opacity=1,
123123
visible=True,
124124
id=5,
125-
parallax_factor=common_types.OrderedPair(1.5, 1.2),
125+
parallax_factor=common_types.OrderedPair(1.0, 1.4),
126126
image=Path("../../images/tile_04.png"),
127127
),
128128
]

tests/test_data/layer_tests/all_layer_types/map.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
}],
5353
"name":"Group 1",
5454
"opacity":1,
55-
"parallaxx":2.3,
56-
"parallaxy":1.2,
55+
"parallaxx":1.4,
5756
"tintcolor":"#0000ff",
5857
"type":"group",
5958
"visible":true,
@@ -79,8 +78,7 @@
7978
"image":"..\/..\/images\/tile_04.png",
8079
"name":"Image Layer 2",
8180
"opacity":1,
82-
"parallaxx":1.5,
83-
"parallaxy":1.2,
81+
"parallaxy":1.4,
8482
"type":"imagelayer",
8583
"visible":true,
8684
"x":0,

0 commit comments

Comments
 (0)