Hundreds of features to explore
Games made in Construct
Your questions answered
Trusted by schools and universities worldwide
Free education resources to use in the classroom
Students do not need accounts with us
What we believe
We are in this together
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
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
If you change the link suffix to ?dl=1 then downloads are automatic from dropbox.
Wow didn't know that. Thanks zenox98 for pointing that out.
Develop games in your browser. Powerful, performant & highly capable.