Skip to content

Commit 885422d

Browse files
authored
Merge pull request #43 from benjamin-kirkbride/development
Merge Development for v1.5.3
2 parents f63890c + 82122c3 commit 885422d

File tree

5 files changed

+14
-3
lines changed

5 files changed

+14
-3
lines changed

CHANGELOG.md

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

77
## [Unreleased]
88

9+
## [1.5.3] - 2021-08-28
10+
11+
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
12+
Layer class would be `None`. This can cause some unexpected behavior in engines or games, and puts the responsibility of checking if this value exists onto the game or engine using it.
13+
14+
This value has been changed to default to (0, 0) if it is not present in the JSON so that games can apply it easily in one line and always get the same result without error.
15+
916
## [1.5.2] - 2021-07-28
1017

1118
This release contains some re-working to properly support templates.

pytiled_parser/layer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ class Layer:
5656

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

6061
id: Optional[int] = None
6162
size: Optional[Size] = None
62-
offset: Optional[OrderedPair] = None
6363
properties: Optional[properties_.Properties] = None
6464
tint_color: Optional[Color] = None
6565

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.2"
3+
__version__ = "1.5.3"

tests/test_data/layer_tests/all_layer_types/expected.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
),
109109
layer.ImageLayer(
110110
name="Image Layer 1",
111+
offset=common_types.OrderedPair(1, 4),
111112
opacity=1,
112113
visible=True,
113114
id=3,
@@ -117,6 +118,7 @@
117118
),
118119
layer.ImageLayer(
119120
name="Image Layer 2",
121+
offset=common_types.OrderedPair(0, 0),
120122
opacity=1,
121123
visible=True,
122124
id=5,

tests/test_data/layer_tests/all_layer_types/map.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
"id":3,
6565
"image":"..\/..\/images\/tile_04.png",
6666
"name":"Image Layer 1",
67+
"offsetx":1,
68+
"offsety":4,
6769
"opacity":1,
6870
"tintcolor":"#ff0000",
6971
"transparentcolor":"#000000",
@@ -88,7 +90,7 @@
8890
"nextobjectid":3,
8991
"orientation":"orthogonal",
9092
"renderorder":"right-down",
91-
"tiledversion":"1.6.0",
93+
"tiledversion":"1.7.2",
9294
"tileheight":32,
9395
"tilesets":[
9496
{

0 commit comments

Comments
 (0)