Snap sprite to TileMap

Godot Version

Godot Engine v4.2.1.stable.official.b09f793f5

Question

I’m making a battleship game, and I want to drag my ships to the right side of my screen, to the left side on top of a TileMap with an 11x11 grid that I drew on it…

I’ve nested my 4 ship sprites in my background image, together with the tilemap as siblings.

I’ve figured out the dragging and added a print to verify that the sprite detects when it’s on top of the TileMap. That all works fine, but I simply can’t figure out how to add a snapping feature to it.

I’m sorry if it’s a very straightforward problem to resolve. I’m very new to Godot and coding in general.

1 Like