Create a Sliding Puzzle Without Arrays

  • 11 favourites

Attached Files

The following files have been attached to this tutorial:



Download now 3.68 MB


5,068 visits, 7,445 views



This tutorial hasn't been translated.


This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Play the game here:

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.




Download now 3.68 MB

  • Order by
Want to leave a comment? Login or Register an account!