How do I set tilemap from JSON file? (Resolved)

0 favourites
  • 5 posts
From the Asset Store
Source code, art assets and music tracks to remake this game
  • Hello fellow Construct users!

    I have been trying to set tilemap from JSON file and have had no luck with it... I was trying to follow the steps in this tutorial video, but alas... does`t work. (Tilemap stays Blank)

    youtube.com/watch

    So, I have tried to import JSON file, then use AJAX to request project file I imported. After that use AJAX

    on completed trigger to set tilemap from JSON -> AJAX-lastdata.... Tilemap stays blank. I have tried to create JSON file with Pyxeledit and even with Construct 2 and 3 with Tilemap -> download JSON.. Nothing has worked. I have tried to search instructions from forums, youtube etc... nothing has come up.

    I also tested setting text object -> set text to JSON file and that worked. So importing and AJAX thingy seems to work but tilemap doesen`t seem to get set..

    Here`s a sample project file. dropbox.com/s/h1yhcykb47mbgsk/TilemapJSONtest.c3p

    Anyway, I really hope some1 has a solution. Thank you in advance.

    Tagged:

  • You need to post your project file and a sample of JSON that you are trying to load.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Here`s a sample project file. dropbox.com/s/h1yhcykb47mbgsk/TilemapJSONtest.c3p

    JSON that I exported from Pyxeledit is imported in the project (in the files section). Tilemap source image that is attached to tilemap object is also exported from the same project in Pyxeledit.

    I haven`t edited JSON file in anyway since export and have no idea if I should... Also, as stated I also tried JSON file downloaded straight from Construct 3, that file is also imported in the project.

    Thanks for your help

  • To load a tilemap saved from C3 use "Tilemap -> Load" action (not "Set from JSON"). Then it works. Try this JSON data:

    {"c2tilemap":true,"width":15,"height":8,"data":"18x-1,4x0,5x-1,2x0,3x-1,2x0,2x-1,2x0,3x-1,3x0,3x-1,0,3x-1,2x0,3x-1,0,9x-1,0,4x-1,0,9x-1,6x0,33x-1"}
    
    

    Not sure if you can load a tilemap made in Pixeledit, as its JSON file has a completely different structure.

    Another format supported in C3 is TMX, you can load TMX files manually in Tilemap bar. So if Pixeledit supports export to TMX, you can do that.

  • Thanks you Sir! It works! I`ll look into TMX also but for now this solution is perfect.

    Thanks again!

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