Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[flame_tiled] add availability to loading TiledMap directly #1533

Closed
Hwan-seok opened this issue Apr 11, 2022 · 1 comment · Fixed by #1534
Closed

[flame_tiled] add availability to loading TiledMap directly #1533

Hwan-seok opened this issue Apr 11, 2022 · 1 comment · Fixed by #1534
Assignees

Comments

@Hwan-seok
Copy link
Contributor

Hwan-seok commented Apr 11, 2022

What could be improved

Change _loadMap to public and create new method static Future<RenderableTiledMap> fromMap(TiledMap map, Vector2 destTileSize)

final map = await _loadMap(contents);

Why should this be improved

Currently, there are only fromFile and fromString methods for making RenderableTileMap and cannot make TiledMap directly.
The fromString uses _loadMap to loading TiledMap and loads the image directly at the next line.
As a result, there is no chance of retrieving and manipulating the map's image path before the image is actually loaded.

_renderableTileLayers(map).map((e) => _loadImages(map)),

Imagine that we want to get images from a remote URL.
But _loadImages loads SpriteBatch directly before we know the path of the imageSets of TileMap.
So we cannot inject the image files from a remote URL before flame loads it from local assets.

Any risks?

Misusing of loadMap..? but this isn't very common.

More information

Are you interested in working on a PR for this? YES

It is a long way to go to acheving dynamically fetching maps.. I think this one is starting.

@spydon
Copy link
Member

spydon commented Apr 11, 2022

Sounds like a good addition to me, I'll assign you to the issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants