So, I'm making a game in which there is a grid of 3x3 and the user needs to create a route by swapping sprites which lead to the objective. But the question is how can I swap the sprites as the they all are the members of the same family? I've tried the picking up the sprite by overlapping of the mouse coordinates but how can I swap them, storing the variables in temporary global variables and then setting the position of the sprite should be there, but I need to do it using family else there would be so much of events just for swapping. Any help would be appreciated?
Like:
on family drop:
is overlapping same family:
pick instance overlapping mouse.x and y: set glob var x to overlapping sprite.x
set glob var y to overlapping sprite.y
set position of dragged sprite to temp x and y
set position of overlapped sprite to var x and y.
Refinements would be appreciated.