Hi,
I’m working on a small game to learn more about MonoGame and I use Nez to import Tiled tile maps.
I noticed that the only way to set colliders is to set a collision layer and the tiles in it get a BoxCollider.
But I need custom colliders, e.g. a 64x64 tile gets a 32x64 collider. I saw that Tiled has a feature to create custom colliders and they are saved in the tmx file like:
<objectgroup draworder="index"> <object id="1" x="0.125" y="26.25" width="5.875" height="5.625"/> </objectgroup>
But Nez doesn’t import objects for tiles. I looked in the Nez.PipelineImporter classes and I have no idea how it works
I figured out that in the TmxTilesetTile.cs the TmxObjectGroup is used to store the objects. But in the TiledMapWriter.cs it’s not used so the information about the objects isn’t in the xnb file.
So I need to customize the TiledMapWriter.cs, the TiledMapReader.cs and TiledTile.cs or something to store the information in?
I tried in TiledMapWriter.cs to write the objects like the properties are written but it doesn’t work to build the Content in the Pipelinetool.
static void writeCustomObjects(ContentWriter writer, List<TmxObject> objects) { writer.Write(objects.Count); foreach (var mapObject in objects) { writer.Write(mapObject.name); writer.Write(mapObject.x); writer.Write(mapObject.y); writer.Write(mapObject.width); writer.Write(mapObject.height); writer.Write(mapObject.rotation); } }
So my questions are:
Am I right with my assumptions?
Is there a good guide or tutorial for custom content importer/processors/writers/Readers…? I haven’t found any