Best practice about the level design/technique

Hi everyone,

I have a general question about the design of my game world. In Tiled, I design my map with different tilesets on different layers, as well as with object layers in which I place individual objects/sprites. Unfortunately, these object layers cannot be implemented in Defold. So how would I design my game world in Defold? Is it all tiles or should I place individual elements such as the player’s house as a sprite on the map?

It’s been a long time since I did this, but you could export Lua from Tiled then parse that file to create objects using factories.

4 Likes

There are multiple approaches to it.

  1. You can simply design/move everything to Defold. It has a built-in Tilemap Editor and you can add on top of it everything (game objects, components representing your level design elements, interactive ones, enemies, etc) already in your collection containing the level. But if I understand you correctly, you are used to design your games in external tools, so:
  2. You can use Tiled/Tilesetter/Sprite Fusion that have export to Defold tilemaps instead of the built-in Editor just to create maps. Then you put everything interactive, objects, etc on top of it in collection as in 1 or:
  3. If your tilemap includes special tiles for every “object” you would like to spawn in the world in a separate layer, you can simply write a parser that will go through your map and if will meet some special tiles, it will use factory and collectionfactory components that you will create to spawn your objects in game.

Games by @benjames171 many times follow 3. approach (open sourced here: GitHub - benjames-171/defold-games: Collection of 2D games made with Defold :heart:)

level.script in Pixel Crypt is such an example: https://github.com/benjames-171/defold-games/blob/master/Pixel%20Crypt/game/levels/level.script

4 Likes

Thank you very much for your detailed answer! I’ll have a look at it today. <3

1 Like