How do I create an object that is in another layout?

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hi, so I want to use layouts like templates, that work like chunks of a map. So that I can edit them on the editor.

    My question is how do I create an object on Layout1 that is on the Layout2, while I'm on Layout1 using js?

    I know that I can use layers or global variables but that gets very messy for me.

    Or maybe having some way of downloading the Layout configs in json and using them as json templates.

  • You can download tilemap data as json and load it again later. Other than that I'm not sure what you mean or where the problem is. What is messy about using layers and global variables ?

  • Yes the json from the tilemaps I'm also aware. I need to have 40 chunks per map for 3 maps so that's 120 layers that I need to have. That just doesn't sound right to me. And working with the layout editor would be better later for maintenance.

    probably i need to find another solution.

  • 120 layers doesn't sound like good game development technique. If you describe the game design and why you need so many maps we can help come up with a solution.

  • Basically i want to make a procedural generated map with 40 chunks each. By a chunk I mean a peace of a map pre-made.

    Then i will randomly peak chunks ant put them together to generate a different map all the time.

    However I think I found a solution. I created a json template for each chunk, with type of object, positions, ... And then it loads the json and generates objects based on the configurations of the json.

    But I can't seem to load a json to the tilemap with js i have used things like

    newTile.#private.LoadFromJson('{"c2tilemap":true,"width":12,"height":14,"data":"84x-1,1,2x-1,9x1,72x10"}') 
    self.C3.Plugins.Tilemap.Acts.LoadFromJSON('{"c2tilemap":true,"width":12,"height":14,"data":"84x-1,2x1,2x-1,8x1,72x10"}');
    
    newTile.#privateWi._LoadFromJson('"{"c2tilemap":true,"width":12,"height":14,"data":"84x-1,2x1,2x-1,8x1,72x10"}"' )

    And nothing seems to work. I know that this is not the main question, but can you help ?

    Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • For the JS I would make a new post in the Scripting help section

  • Using JSON templates for creating maps is a smart idea! Maybe try testing with a smaller JSON setup to see where the issue is. You could also ask in the Scripting Help section for tips on loading JSON with JS. Hope it works out

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