How do I use the Tiled map editor with construct 2?

0 favourites
  • 9 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hello all!

    I've used a software for my level designing in c++ and java in the past called tiled: mapeditor.org

    I want to try to get the following map working from mapeditor into construct 2:

    This map is 64 x 64 tiles, and uses the tiles as palleted here:

    Tiled outputs a JSON file, in this case, the map's JSON file can be found on pastebin: pastebin.com/06qAUJKr

    I have seen the tutorial here: scirra.com/tutorials/978/example-load-data-from-json-to-array-and-populate-game-card load data from json to array, but the lack of diverse examples still puzzles me. here is my current attempt, simmilar to the tutorial:

    and this produces the incorrect tileset, as it seems to look like so:

    This obviously means that the array isn't loading the data properly, but I cannot figure out for the life of me why it is not loaded, I've popped the data into multiple online parsers, yet this still baffles me. Could someone please enlighten me to the error of my ways?

  • I'm not very familiar with tilemaps myself, but can't you load json data directly into the tilemap object? I don't think you need an intermediate array...

  • I might be missing the point of what you are trying to do, but is there any reason you don't want to use the tilemap object? You could import the tmx file and your tiles straight into C2 with that?

  • I'm trying to let my artists make maps and levels, and then be able to export them directly to JSON, which will then be loaded into construct 2.

  • you have two on start on layout ...it might be paralleling the action Try to take out the 2nd on start and use a timer delay of say 2 sec and then create the map. You might need to let the system process the data for the array before letting it populate i had the same problem well not in array but Ive had one instance where the dictionary for various things would not all load so it ended up glitching my learning of zelda tutorial.

    Try that see if you come up with a different result?

  • So, I've figured out how to use this with the JSON plugin from here: github.com/FrenchYann/JSON_for_construct2

    The problem now is; I cannot access the JSON nessecary for layers.

    The JSON looks something like

    {
    "layers":[
            {
             "name":"layer1",
             "data":[...]
            },
            {
             "name:"layer2",
             "data":[...]
            }]
    }
    
    [/code:14e3mx69]
    
    As you can see, there is an array inside an array. Thus, I've changed my script to the following:
    [img="http://image.prntscr.com/image/7ac98bebb0104cd184b3160e2d76eb10.png"]
    
    However, the tilemap still comes out as above (only 15x15.)
  • Try Construct 3

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

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

  • tuskiomi

    Have you figured out a solution yet? I recommend using TMX Exporter v2 by I would start with the older thread for the first version of the plugin because the operation is explained there in detail.

  • rex_tmx_importer_v2 could load tmx string, parse and fill the result into official tilemap object.

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