Load tilemap

  • Hi guys!

    I am quite new to construct and I am currently struggling with a problem and couldnt find any solutions on the internet. I am currently looking for a way to make some parts of the level design for my game randomized. To do this I would like to replace one tilemap design with another. I couldnt find a good way of doing it yet.

    It seems there is a possibility to download a tilemap design. For testing purpose I downloaded this json: {"c2tilemap":true,"width":2,"height":2,"data":"4x16"}

    I am currently struggling with loading this json to another tilemap. I tried to load the json to the tilemap by pasting the json I received. Unfortunately construct is telling me there are some syntax error (unknown characters) so I guess I am doing something completely wrong.

    Does anyone have any idea how to solve this problem or how to do it proper?

    Best regards!

  • why not create them as sprite/objects? you can set them to _ on the z-order (this ensures they appear as backgrounds), then create a second set of objects/sprites that spawn the background objects, then to make it random you can create a number variable and set the value as round(random(1,6)); this selects a number between 1 and 6.

    then just set it so if number variable = 1, then have spawner spawn background object 1, if number variable = 2, then have spawner spawn background object 2, and so on.

  • Hi Smumpy,

    thanks for your reply. I think I get what you mean and think this could be a possible solution if there is no alternative. But for now I still would like to try it by loading a tilemap. Do you have any idea how to do that in a proper way?

    Best regards

  • My first thought would be to do it with events, doing a "set tile" as needed to randomize your map. But are you instead hand-building tilemaps, and want to load those at runtime?

    C3 Tilemap docs:

    https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/tilemap

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I want to build for example 1 level by putting together 9 randomly choosen tilemaps. Each tilemap has been built before already. So in the end it wont completely random.

    I actually found a solution. I had to request a file ajax and then load it to an empty tilemap. I can go to sleep in peace now :)

    Best regards

  • yo dawg, I have the same problem, I tried to request it with an ajax file and then load it as a tilemap but it doesn't work. If you have a few spare seconds, can you give it a look, please?

    construct.net/en/forum/construct-2/how-do-i-18/cant-load-tilemap-from-json-fi-140804

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