How should I go about creating a 2-D sandbox game?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By redstonecreeper8

I want to create a simple, 2-D sandbox game where the player is able to place and remove tiles in the game world. Each unique type of tile to be able to drop different items (similar to Terraria). How shoud I go about doing this? Would a TileMap node work, or should I use individual StaticBodies, etc? How can I implement placing/breaking tiles? Thanks in advance for any help!

:bust_in_silhouette: Reply From: estebanmolca

The class TileMap, and its TileSet resource, have several properties and functions to be used from script, including:
You can refer to a tile with its Id (which is unique) or the name you gave it when creating it.
You can exchange one tile for another or delete it. You can change entire groups if you use this in a loop or you can generate random tiles → procedural maps!
You can pass world coordinates (pixels) to tilemap coordinates (tiles) and vice versa for example, to detect in which tile is the mouse pointer.
The tiles can carry collisions, navigation, etc. You can also animate them, but I don’t know how, one way is with an AnimateTexture, for example to show the frames of a block that is breaking. I believe that with TileMaps you can do what you want, and obviously combining it with other godot nodes for specific parts like static bodies as you said. Study the TileMap and TileSet documentation and search godot tutorials with words like terraria, minecraft, procedural maps etc.