Exemplo n.º 1
0
from pathlib import Path

from pytiled_parser import common_types, layer, tiled_object

EXPECTED = [
    layer.TileLayer(
        name="Tile Layer 1",
        opacity=1,
        visible=True,
        id=1,
        size=common_types.Size(16, 16),
        offset=common_types.OrderedPair(163.089434111595, 116.462603878116),
        properties={
            "test": "test property",
        },
        chunks=[
            layer.Chunk(
                coordinates=common_types.OrderedPair(0, 0),
                size=common_types.Size(4, 8),
                data=[
                    [
                        1,
                        2,
                        3,
                        4,
                    ],
                    [
                        9,
                        10,
                        11,
                        12,
Exemplo n.º 2
0
     {
     "ellipse":true,
     "height":18.5517790155735,
     "id":6,
     "name":"name: ellipse",
     "rotation":0,
     "type":"ellipse",
     "visible":true,
     "width":57.4013868364215,
     "x":37.5400704785722,
     "y":81.1913152210981
     }
     """,
     tiled_object.Ellipse(
         id=6,
         size=common_types.Size(57.4013868364215, 18.5517790155735),
         name="name: ellipse",
         rotation=0,
         type="ellipse",
         visible=True,
         coordinates=common_types.OrderedPair(37.5400704785722,
                                              81.1913152210981),
     ),
 ),
 (
     """
     {
     "ellipse":true,
     "height":31.4288962146186,
     "id":7,
     "name":"name: ellipse - invisible",
Exemplo n.º 3
0
from pathlib import Path

from pytiled_parser import common_types, layer, tiled_object

EXPECTED = [
    layer.TileLayer(
        name="Tile Layer 1",
        opacity=1,
        visible=True,
        id=1,
        size=common_types.Size(8, 6),
        offset=common_types.OrderedPair(1, 3),
        parallax_factor=common_types.OrderedPair(1.4, 1.3),
        properties={
            "test": "test property",
        },
        tint_color=common_types.Color(170, 255, 255, 255),
        data=[
            [
                1,
                2,
                3,
                4,
                5,
                6,
                7,
                8,
            ],
            [
                9,
                10,
Exemplo n.º 4
0
 1:
 tileset.Tile(
     id=1,
     image=Path("../../images/tile_02.png"),
     image_height=32,
     image_width=32,
     objects=layer.ObjectLayer(
         name="",
         opacity=1,
         visible=True,
         draw_order="index",
         tiled_objects=[
             tiled_object.Rectangle(
                 id=2,
                 name="",
                 size=common_types.Size(14.4766410408043,
                                        13.7196924896511),
                 rotation=0,
                 type="",
                 visible=True,
                 coordinates=common_types.OrderedPair(
                     13.4358367829687, 13.5304553518628),
             ),
             tiled_object.Ellipse(
                 id=3,
                 name="",
                 size=common_types.Size(14.287403903016,
                                        11.070372560615),
                 rotation=0,
                 type="",
                 visible=True,
                 coordinates=common_types.OrderedPair(
Exemplo n.º 5
0
from pathlib import Path

from pytiled_parser import common_types, layer, tiled_map, tileset

EXPECTED = tiled_map.TiledMap(
    hex_side_length=6,
    stagger_axis="y",
    stagger_index="odd",
    infinite=False,
    layers=[
        layer.TileLayer(
            name="Tile Layer 1",
            opacity=1,
            visible=True,
            size=common_types.Size(10, 10),
            id=1,
            data=[
                [
                    3,
                    3,
                    3,
                    3,
                    9,
                    9,
                    9,
                    9,
                    17,
                    17,
                ],
                [
                    3,
Exemplo n.º 6
0
from pathlib import Path

from pytiled_parser import common_types, tiled_map, tileset

EXPECTED = tiled_map.TiledMap(
    infinite=False,
    layers=[],
    map_size=common_types.Size(8, 6),
    next_layer_id=2,
    next_object_id=1,
    orientation="orthogonal",
    render_order="right-down",
    tiled_version="1.4.1",
    tile_size=common_types.Size(32, 32),
    version=1.4,
    background_color=common_types.Color(255, 0, 4, 255),
    tilesets={
        1:
        tileset.Tileset(
            columns=8,
            image=Path("../../images/tmw_desert_spacing.png"),
            image_width=265,
            image_height=199,
            margin=1,
            spacing=1,
            name="tile_set_image",
            tile_count=48,
            tiled_version="1.3.1",
            tile_height=32,
            tile_width=32,
            version=1.2,