Jump to content
  • Advertisement
Sign in to follow this  
Juls

Making a sliding puzzle

This topic is 2125 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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!

 

 

Share this post


Link to post
Share on other sites
Advertisement
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!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!