The system is built by selecting a block using a hot panel

Godot Version

4.2.1

Question

Hi! I would like to know how I can create a construction system by selecting a block through a hot panel in 2D TopDown

Explain what you want to acheive in more detail or it will be very hard to help you.

Sorry. I have a hotbar and I would like to know how to select a specific block and then place it on a tilemap in 2D Top Down.

Let’s say I selected a certain block and then was able to place it on a TileMap.

If you have already made the selector for it, all you need to do is have some kind of mapping that tells you which tilemap tile corresponds to the item in the hotbar and then create that tile in the tilemap.

Thanks!

I would like to know if you have an example of how to implement this? I’m trying to figure out how to put a block directly from the hotbar on Tilemap :smiley: I’m still new to this plan.

Show what you have made and we can work from there.

I have a hotbar like in this video (I decided to throw off the video because it has everything at once and I don’t have to throw it in parts, but I hope it will be more convenient for you?)

Based on this I think the things you have to do are something like this:

  • Add “Tile” to the type enum in the Item script so it can be different from weapons etc.
  • Create an abstract_item_tile class that is similar to the Weapons, but when activated it places a tile instead. It will use the “Tile” enum value instead.
  • Add a var tile to your item tile script. The type of this should match whatever type your player-placed objects use. (You’ll need to create that at some point if you haven’t)
  • When you place a tile, you want to change the TileMap you are on at the position you are on, using the information of this tile variable in the item tile.
  • Make instances of this object when you want to give a tile to the player, making sure to set the variable that tells which tile it is appropriately.

If you have more questions, go ahead. This should be enough info I hope.

1 Like

Thank you very much! I will try to do this and if anything, of course, I will ask questions :slight_smile: