'Flutter flame_tiled load collisions
Is it possible to load collisions from tsx with level into flame_tiled?
final level = await TiledComponent.load('intro.tmx', Vector2.all(32));
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.8" tiledversion="1.8.2" name="terrains" tilewidth="32" tileheight="32" tilecount="247" columns="19">
<image source="../tilesets/terrains.png" width="608" height="416"/>
<tile id="20">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="32" height="32"/>
</objectgroup>
</tile>
<tile id="21">
<objectgroup draworder="index" id="2">
<object id="1" x="0" y="0" width="32" height="32"/>
</objectgroup>
</tile>
<tile id="22">
....
Solution 1:[1]
It is unfortunately not possible currently.
There is a 3rd party library called flame_forge2d_tiled which can create Forge2D bodies from the tiled definitions, but then you have to use Forge2D instead of the built-in collision detection system.
flame_forge2d is not as mature as Flame itself, so depending on what you want to do it might be worth it to create the hitboxes manually in Flame instead.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | spydon |
