How to make a sliding puzzle where that one piece is not missing
Hey guys,
I want to make a puzzle sliding game in 2D,
I dont want that last piece to be missing, so for example there is a 3x3, so 9 tiles. If you move one tile to the left, the tile that gets pushed out should go back in on the other side. i dont really know how to explain it.
hopefully this wil help:
1|2|3
4|5|6
7|8|9
and when i slide Nr.2 to the left, it wil look like this:
2|3|1
4|5|6
7|8|9
and when i slide Nr.1 to the top it wil look like this:
2|3|6
4|5|9
7|8|1
How can i accomplish this?
Thanks in advance!
So far i have made a 8 tile puzzle game, added the 9 tile,
$$anonymous$$ade the detection so that i can drag a tile up down left or right.
Now i just need to make it so that when the tile goes, that whole line goes and i transform one tile to the other side
$$anonymous$$aybe you could check if the transform position gets out of the bounds of the puzzle and therefore should be placed back one tile (back in bounds) and then directly to the other side (in the empty slot).
Or you could have a trigger on the puzzle and when that is exited by an object, place that object back in the puzzle in the empty slot.
Should be an easy fix, but maybe there are some kind of special demands for your project. $$anonymous$$aybe a screenshot from your game could help create an image for us :) .
Your answer
Follow this Question
Related Questions
How to recreate a puzzle like this. 0 Answers
Split image and placing to choice side when game starts 0 Answers
Nav Mesh Question 0 Answers
Large terrain pathfinding 0 Answers