[plugin] rex_tmx_importer_v2

0 favourites
From the Asset Store
Antisuspend Plugin for Construct 3 prevents the runtime from getting suspended.
  • Hello rexrainbow! Enjoying your plugins!

    I have considered adding an ingame level editor to my game. I wonder if it is possible for you to create TMX-exporter to json files. Or maybe it is not good idea and too complicated?

  • helena

    These plugins only could read tmx file, they could not create tmx file.

  • rexrainbow I know. I just was wondering if you could create a new plugin for exporting. But I know it might be too much work.

  • helena

    Sorry, I don't have plan to make new plugin recently,

  • Hello,

    Ok, thank you for letting me know.

  • digitalsoapbox

    Bit of an old thread, but I just noticed this and saw that you are iterating through TMX Objects (not Tiles). I had mention this to rexrainbow recently about adding support to reference Tileset-related parameters for Objects. At the moment, if I'm not mistaken, only Tiles properly reference their Tilesets. In Objects (and in Tiled, that's the Tile Image Object), the plugin is required to make a connection with the 'gid' parameter to the Tileset.

    Anyway, I was wondering if you solved your issue and how.

    (For personal use, I modified Rex's code and got Image Objects to reference their frame, but I think Rex might be doing his own modifications, if indeed what you're experiencing is rooted in this.)

  • faulknermano

    I can work on it 2 or 3 days later. Now I am away from keyboard.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • faulknermano

    I can work on it 2 or 3 days later. Now I am away from keyboard.

    Oh hey rexrainbow no pressure! If I came across in any way pestering or nagging, it's not the case. Thanks very much for all your work to date. I'm leaning a lot from reading your code especially because its functionality is a perfect fit for the stuff that I'm doing. It's much better to learn code examples of things that are actually useful.

  • I have considered adding an ingame level editor to my game. I wonder if it is possible for you to create TMX-exporter to json files. Or maybe it is not good idea and too complicated?

    helena, have you considered using Rex's JSON builder (http://c2rexplugins.weebly.com/rex_json_buider.html) in order to construct your JSON strings and then write them back via the AJAX object?

    Of course, it is a bit of work, but much more convenient than doing it manually.

    If you want to export TMX, you could also try rex_xmlwriter (http://c2rexplugins.weebly.com/rex_xmlwriter.html), but like before, you'd still need to read up on TMX format. But it is quite doable, I think.

  • Thank you, faulknermano! All tips helps!

  • I don't get object property, on each object > for each object property.

    Work it for layer, dont work for objects.

    Thx for help.

  • digitalsoapbox

    Bit of an old thread, but I just noticed this and saw that you are iterating through TMX Objects (not Tiles). I had mention this to rexrainbow recently about adding support to reference Tileset-related parameters for Objects. At the moment, if I'm not mistaken, only Tiles properly reference their Tilesets. In Objects (and in Tiled, that's the Tile Image Object), the plugin is required to make a connection with the 'gid' parameter to the Tileset.

    Anyway, I was wondering if you solved your issue and how.

    (For personal use, I modified Rex's code and got Image Objects to reference their frame, but I think Rex might be doing his own modifications, if indeed what you're experiencing is rooted in this.)

    I missed this comment originally. I still can't get the correct frame from objects using this importer.

  • digitalsoapbox

    Rex PM'd me about a TMX Importer V2 update but it seems he had forgotten to update this thread.

    Here's a direct quote from rexrainbow

    Please update tmx related plugins.

    Add new expression:ObjectRefGID to get reference gid of an object, and extend expression:TilesetName( gid ) to get tileset name of a specific tile (gid).

    ex : TMXImporterV2.TilesetName( TMXImporterV2.ObjectRefGID )

    Hereis a sample capx.

    The 'gid' is what you're looking for. It's basically the 'frame number' of the Object, as it were.

    I also believe that Rex updated only the one in his main site, not the Github one, last I checked.

  • digitalsoapbox

    Rex PM'd me about a TMX Importer V2 update but it seems he had forgotten to update this thread.

    Here's a direct quote from rexrainbow

    > Please update tmx related plugins.

    >

    > Add new expression:ObjectRefGID to get reference gid of an object, and extend expression:TilesetName( gid ) to get tileset name of a specific tile (gid).

    > ex : TMXImporterV2.TilesetName( TMXImporterV2.ObjectRefGID )

    > Hereis a sample capx.

    >

    The 'gid' is what you're looking for. It's basically the 'frame number' of the Object, as it were.

    I also believe that Rex updated only the one in his main site, not the Github one, last I checked.

    faulknermano rexrainbow

    Thanks! I'll poke around with it and see if I can get it working.

    This works to set the animation, but what do I need to do to set the animation frame? I'm getting the right tileset name to reference for setting the animation from TMXImporterV2.TilesetName( TMXImporterV2.ObjectRefGID ), but not a tile ID to reference as frame number.

  • digitalsoapbox

    I see the issue. The ObjectRefGID is the raw value, but in order to extract the frame ID, the plugin also needs the 'firstgid' parameter from the Tileset because the frame number is relative to the tileset being used. IE: frameNumber=TilesetFirstGID-ObjectRefGID.

    As the plugin currently stands I think rexrainbow might need to add the retrieval of the Tileset's 'firstgid' parameter in order to extrapolate the frame number. Sorry for getting your hopes up, but hopefully, Rex will pipe up.

    In the meantime, Bjorn, the Tiled developer (am I right in assuming you are using Tiled), doesn't recommend using Tile IDs to reference tiles in a tileset because they are 'volatile'. I had to agree with him because I found out in my situation, I could not reset certain tiles to start at 0 within Tiled. For example, in one of my tilesets, the first tile's id is 3, and there are some the skipped a number. And so referencing them in C2 was yielding incorrect frames even though the tile ordering was identical.

    The only practical solution for me was to apply a custom property to each individual tile assigning them a frame number. I think this a much better solution as it is predictable. Also, it is also possible to parse the TMX externally that will procedurally make the correspondence between the TMX tileset and the animation frames in C2.

    Lastly, I have modified Rex's code specifically for this 'Image Object Tile ID' requirement, but I have not requested Rex to 'pull' my modifications as I think it's better for Rex to maintain his plugins. If Rex allows me to post modifications to his code then I'll do that here.

    But again, I personally have abandoned the idea of using Tile IDs for frame numbers mainly because they're not dependable.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)