How can i do a Sliding Puzzle?

Hi, i know how make a jigsaw but i need make a Sliding Puzzle on Blueprints, like this Puzzle Unreal Engine 4 (01) beta - YouTube

1 Like

Are you asking about how to make an entire game or…? There are a lot of elements that have gone into this. Perhaps you could break it up into more digestible pieces, especially if you’re new to all this. Here’s a start:

Dividing a single image into interactive actors, I made this on a whim so it’s rather bare bones:
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1411963-can-blueprints-be-used-to-chop-an-image-into-pieces?p=1412068#post1412068

Depending on how complex and scalable the end result needs to be, there would be more or less elements that need to go into this, for the maximum simplicity I’d try:

  • assign the pieces initial correct coordinates during the creation loop; so each piece knows that is has reached the correct spot once the puzzle is ready to be solved. The 2D macro will spit them out for you, just have the actors store them.
  • for movement, I’d probably just do a short line trace to see if there’s empty space a piece can move to - so 4 traces North, South, East & West in a Break loop until an empty space is found (the whole thing can be calculated manually, of course, since you have the coords, but the traces will be easier to set up). For simplicity sake you can put a border around the pieces to skip checks around the edges and prevent pieces moving beyond them.
  • use Snap Vector to Grid to find a resting position (or calculate manually again - you know the board size, piece size and the gap between the 2) and a Timeline to move them; check here if the coords are matching - you will need to do it for all pieces

That should work. There will be some gotchyas here, surely.

1 Like

I understood it very well, right now I will be testing it, YOU ARE THE BEST!!!
I THANK YOU A LOT, and I’m sorry about my English.