Just started, learning. Best way to handle dynamic creation of map

Hello. Just starting with Defold and working on migrating an existing client to Defold. I have the situation where I receive the map as individual terrain objects:

{
width = 256,
z = -40,
x = -100,
y = -160,
height = 256,
terrain_id = tree_1.png,
blocking = true,
}

Using Defold, what way would be used to render these objects as a game map, assuming the “.png” file referenced is in a local folder within the Defold project. The individual objects can stack on top of each other given the z position.

Thank you,

Barry

You have at least two options:

  1. Put all of the pngs into an atlas and let each tile be represented by a game object with a sprite, laid out in a grid.
  2. Assuming all tiles are of equal size you can put all of the pngs into a single image, create a tilesource and use a tilemap that you manipulate at runtime.
1 Like