Skip to content

Positional data for Isometric maps #7

@tviel

Description

@tviel

Generating an isometric map with tiled and exporting it. Loading of the tiled map file and adding itself as a component shows the expected result. However, using the TileProcessor.processTileType and taking the position results in non-isometrical aligned sprites.

The isometric map in tiled (4 tiles placed in a tile layer):
image

The loaded tmx in flutter / flame:

  • above as loaded TiledComponent and added to the world
  • below the TileProcessor placed sprites
    image

Here the used code for loading and adding the map and tiles


Future<void> _loadWorldForChallenge() async {
    _mapComponent =
        await TiledComponent.load('challenges_1.tmx', Vector2(64, 32));

    add(_mapComponent);

    TileProcessor.processTileType(
        tileMap: _mapComponent.tileMap,
        processorByType: <String, TileProcessorFunc>{
          'region': ((tile, position, size) async {
            final sprite = await tile.getSprite();
            add(
              SpriteComponent(
                  sprite: sprite, position: position, size: Vector2(384, 208)),
            );
          }),
        },
        layersToLoad: [
          'regions',
        ]);
  }
  

Is the package ready for isometric maps from tiled?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions