3

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">
....

1 Answers1

0

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.

spydon
  • 9,372
  • 6
  • 33
  • 63