I have 4 sprites (A, B, C, D). I drag and drop sprite C to the position of sprite B. They swap positions for each other. How do I do that?
Give your sprites instance variables where you store the start position.
On start drag -> set Sprite_A.PosX/PosY to Sprite_A.X/Sprite_A.Y
On drop and overlap Sprite_B -> Set Sprite_A position to Sprite_B; Set Sprite_B to Sprite_A.PosX/PosY
Following example does swapping by clicking 2 sprite; https://www.dropbox.com/s/7cwh6xxz6ms9epw/match_by_swap.capx?dl=1
You can modify it to works with drag & drop behavior.
*if by clicking the link won't open, copy paste the link text into browser addresss
alextro
If you change the link suffix to ?dl=1 then downloads are automatic from dropbox.
Develop games in your browser. Powerful, performant & highly capable.
Wow didn't know that. Thanks zenox98 for pointing that out.
Thanks alextrozenox98