Tutorial Downloads

File Size
Scirra Slider2.capx3.68MB


Know another language? Translate this tutorial!

Create a Sliding Puzzle Without Arrays

Favourite 7 favourites
Tutorial written by lamarOriginally published on 2nd, September 2015 - 1 revision

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!

View deals

Plus, it's got a lot of additional features that will help you save time and make more impressive games!

Congratulations on finishing this tutorial!

Did you learn a lot from it? Share it now with your friends!

Share and Copy this Tutorial

You are free to copy, distribute, transmit and adapt this work with correct attribution. Click for more info.


M3L1 327 rep

Como hago para agregar más puzzles a este, sería como diferentes niveles! Y darle a la imagen armada un efecto de luz alrededor a la imagen ya armada.
¿Puedo hacerlo con la versión free del construct2 o no?
Muchas gracias!!

Thursday, March 31, 2016 at 10:57:00 PM

Leave a comment

Everyone is welcome to leave their thoughts! Register a new account or login.