Welcome to the forums @bsp!
By merge mechanics, do you mean merging to objects that are beside each other that are of the same type? If so, there are several different ways of handling this depending on how the game is setup. If you are using a tile-based game, then the easiest way is to check to see if the nearby tile is of the same type as the existing, and then trigger an animation (or something) to visually show a merge and then set the tile to the newly created thing.
I couldn't find any tutorials on it either, but I would suggest breaking the mechanic down into smaller parts and then combining them together to get the desired functionality. For example, here's how I would break it down:
- Placing items in a grid
- Several ways to do this: Use a TileMap node, use a Dictionary with the keys as the positions and the values as the reference to the item, etc.
- Moving items in the grid using the mouse/touch/etc (if there is player movement input)
- Detect if the mouse/touch/etc is over an item
- If the mouse/touch/etc is over an item and pressed, then "pick up" the item
- If an item is "picked up", then allow for moving it around the grid
- This could be just to nearby tiles (check distance from current tile) or all over the map, depending on game play mechanics.
- Moving items in the grid only if there isn't already an item at that position in the grid
- When moving the item, check to see if there is something already there. If there is, do not allow moving to that position
- Adding ID or some way to tell what item in the grid is what via code
- This is so you can tell which item is which through code, which will be needed for merging
- Moving item in the grid onto item in grid with same ID
- Similar to step 3, moving only if there isn't an item. Check first if there is an item there or not, and if there is an item, check it's ID to see if it's the same. If it is, then merge, otherwise, do not allow object to move to that position in grid.
- For merging, initially just delete both items and spawn a new merged one at the tile position. Later you can add animations, sounds, etc, to show the merge.
Hopefully this helps a bit with giving some ideas on what you might need to look into to make a merging mechanic. :smile: