gurkenlabs / litiengine

LITIENGINE 🕹 The pure 2D java game engine.
https://litiengine.com/
MIT License
732 stars 93 forks source link

Implement support for tileset collision #335

Open steffen-wilke opened 4 years ago

steffen-wilke commented 4 years ago

Currently, we don't support tileset collision information configured in Tiled.

image

In the end, this results in an objectgroup XML element in the tileset (.tsx).

Example tileset:

<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.2" tiledversion="1.2.3" name="tileset" tilewidth="8" tileheight="8" tilecount="256" columns="16">
 <image source="tileset.png" width="128" height="128"/>
 <tile id="7">
  <animation>
   <frame tileid="7" duration="300"/>
   <frame tileid="8" duration="100"/>
  </animation>
 </tile>
 <tile id="21">
  <objectgroup draworder="index">
   <object id="4" x="0" y="0" width="8" height="8"/>
  </objectgroup>
 </tile>
 <tile id="37">
  <objectgroup draworder="index">
   <object id="2" x="0" y="0" width="8" height="8"/>
  </objectgroup>
 </tile>
</tileset>

Once we support this, we should also think about generating static CollisionBoxes from it when loading a map.

This was originally reported in our community forum: https://forum.litiengine.com/d/118-customise-movement-to-repeat-until-stopped

TheRamenChef commented 4 years ago

I think, more generally, we need to update the engine to support Tiled 1.3.

TheRamenChef commented 4 years ago

I've added support for parsing tile collision information; it still needs to be actually loaded into the collision engine.