Jump to content

  • Log In with Google      Sign In   
  • Create Account


Making a sliding puzzle


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Juls   Members   -  Reputation: 102

Like
0Likes
Like

Posted 18 February 2013 - 01:26 PM

Hello guys!

I am trying to create a sliding puzzle, like this for the kinect: 

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!

 

 



Sponsor:

#2 Lil_Lloyd   Members   -  Reputation: 287

Like
0Likes
Like

Posted 18 February 2013 - 08:22 PM

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!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS