mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-27 22:59:48 +01:00
Fix for only one parallax value being set. (#45)
This commit is contained in:
@@ -356,10 +356,15 @@ def _get_common_attributes(raw_layer: RawLayer) -> Layer:
|
||||
if raw_layer.get("properties") is not None:
|
||||
common_attributes.properties = properties_.cast(raw_layer["properties"])
|
||||
|
||||
parallax = [1.0, 1.0]
|
||||
|
||||
if raw_layer.get("parallaxx") is not None:
|
||||
common_attributes.parallax_factor = OrderedPair(
|
||||
raw_layer["parallaxx"], raw_layer["parallaxy"]
|
||||
)
|
||||
parallax[0] = raw_layer["parallaxx"]
|
||||
|
||||
if raw_layer.get("parallaxy") is not None:
|
||||
parallax[1] = raw_layer["parallaxy"]
|
||||
|
||||
common_attributes.parallax_factor = OrderedPair(parallax[0], parallax[1])
|
||||
|
||||
if raw_layer.get("tintcolor") is not None:
|
||||
common_attributes.tint_color = parse_color(raw_layer["tintcolor"])
|
||||
|
||||
@@ -83,7 +83,7 @@ EXPECTED = [
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=4,
|
||||
parallax_factor=common_types.OrderedPair(2.3, 1.2),
|
||||
parallax_factor=common_types.OrderedPair(1.4, 1.0),
|
||||
tint_color=common_types.Color(0, 0, 255, 255),
|
||||
layers=[
|
||||
layer.ObjectLayer(
|
||||
@@ -122,7 +122,7 @@ EXPECTED = [
|
||||
opacity=1,
|
||||
visible=True,
|
||||
id=5,
|
||||
parallax_factor=common_types.OrderedPair(1.5, 1.2),
|
||||
parallax_factor=common_types.OrderedPair(1.0, 1.4),
|
||||
image=Path("../../images/tile_04.png"),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -52,8 +52,7 @@
|
||||
}],
|
||||
"name":"Group 1",
|
||||
"opacity":1,
|
||||
"parallaxx":2.3,
|
||||
"parallaxy":1.2,
|
||||
"parallaxx":1.4,
|
||||
"tintcolor":"#0000ff",
|
||||
"type":"group",
|
||||
"visible":true,
|
||||
@@ -79,8 +78,7 @@
|
||||
"image":"..\/..\/images\/tile_04.png",
|
||||
"name":"Image Layer 2",
|
||||
"opacity":1,
|
||||
"parallaxx":1.5,
|
||||
"parallaxy":1.2,
|
||||
"parallaxy":1.4,
|
||||
"type":"imagelayer",
|
||||
"visible":true,
|
||||
"x":0,
|
||||
|
||||
Reference in New Issue
Block a user