Using Tilemaps in GUI (SOLVED)

Hii,
While playing around with Defold GUI for a while, I really wonder whether we can use Tilemaps in GUI?

No, there is no support for that. But since you can dynamically create gui nodes it would not be too hard to do something similar to tilemaps with a piece of Lua.

Can you please explain deeply( I don’t know a slice about GUI dynamic creation )?

Let me ask another question: Why do you need the tilemap in the gui? What is it you are trying to achieve? I’m sure there’s another option than trying to recreate a tilemap system using gui nodes.

To answer your question: You can create new gui box nodes using:

gui.new_box_node()

And assign an image/animation from the atlas using:

gui.set_texture(node)
gui.play_flipbook(node, animation)

map-tileset-32x32
this is the tile source that i’m using. and I want to make something like this


It can be very easily reproduced using tilemaps… So, I asked this…

1 Like

You can overlap many tilemaps. I suggest you make the “worldmap” show up and make it’s origin or it’s location to the game window itself. So it follow the camera view. Not recommanded but it’s surely possible.

You can also make a tilemap with a custom material and tag and render it with the same view and projection as the GUI.

4 Likes

I still don’t understand. What is it in the above example image that requires a Defold gui? Why not do it with a tilemap and some sprites?

The thing is that the example was actually a level select system and I wanted these to be the button, which when clicked shall open the respective levels.
tile050tile059tile058tile060tile051

You can make the map as a regular tilemap in a game object and put the clickable images in a GUI. It will be rendered on top.

3 Likes

Sorry for the late reply, but it’s working exactly as I needed.(maybe i was thinking the wrong way).
Thanks a lot…

2 Likes