Skip to main content
GameDev.net gamedev.net
🔒 Locked

Making a sliding puzzle

Started by Juls Feb 18, 2013 at 7:26 PM 0 replies 4.1k views
Original Post
Juls
Juls

Hello guys!

I am trying to create a sliding puzzle, like this for the kinect: http://vimeo.com/22839911

Unfortunately I am learning how to use all of this only now so I am pretty confused.

In order to make this puzzle I decided to start out by just making a sliding puzzle using the XNA framework with some random image I choose and then add the next features.

I divided it in the following tasks:

*Open image (or draw the sprite)

*Slash it into various squares and separate it

*Randomize it

*Mouse controls to put everything back in place

I am sad to say I got stuck on my second task. I have no idea how to slash a sprite into various sprites and then move them around. I looked around desperately but so far haven't found anything that helps.

I really really need this done by next week and any help would be great.

Thank you very much for your time!

Lil_Lloyd
Lil_Lloyd
What you need to do is have many quads (tiles or squares in the puzzle) and have the main image as a texture. Then for the coordinates of the quads you also need texture coordinates between 0.0 and 1.0. As an example if I had four squares the texture coordinates of the top left square would be

(0.0,0.0)---------(0.25,0.0)
| |
| |
| |
(0.0,0.25)--------(0.25,0.25)

As the square moves around its screen coordinates will change but its texture coordinates will remain constant. I also made a sliding puzzle some time ago, you can see it under my projects here: http://www.lloydcrawley.com/projects/ at the bottom of the screen

There is a github repo link there too if you want to look at the source code. Good luck!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.