Klondike solitaire snappiness

I am creating a klondike solitaire of my own.
I successfully managed to deal the cards just like klondike but the drag and drop feature is not working.
how can I make it work and how can I add the snappiness logic of klondike to my game?
i.e when u drag and drop a card on top of another one it alignes perfectly just like windows solitaire

Snapping in general is just:

if distance from currentPos to targetPos < snapDistance then: pos = targetPos.

While you’re dragging, just loop through the available drop positions to get the closest one, if it’s within the snap distance threshold (depending on your distance threshold there could be multiple positions to snap to).

4 Likes