Play the game here: https://www.scirra.com/arcade/puzzle-games/scirra-slider-puzzle-includes-capx-download-2124
I like sliding puzzles and they have many uses as a standalone game or as a puzzle within a larger game.
You can use arrays to create these but it is more complicated so I came up with a simple slider puzzle that uses a place holder for the empty slot and just switches the sprite that is overlapping that place holder.
You need a couple of global variable to hold the clicked puzzle piece X and Y coordinates so you can set the place holder to that coordinate.
NOTE: Pay special attention to the polygon collision detector used for the place holder empty slot.
The place holder polygon is diamond shaped roughly so only the corners that would overlap the puzzle pieces are in contact with the place holder.
That prevents any overlap from the puzzle piece that is on a diagonal from the place holder from moving by mistake.
I included a 9 piece graph you can use to design your own puzzles. You can make this game with more pieces if you wish to.
The CAPX has all the comments to explain how it works and the game is in the arcade so please come by and give it a try and leave a rating.
Unlock your full gamedev potential
Upgrade to the Personal Edition of Construct 2, it has way more features and won't holding back from making money and using your full creativity like the free edition does. It's a one off payment and all Construct 2 editor updates are free for life!
Plus, it's got a lot of additional features that will help you save time and make more impressive games!