Sliding Puzzle

Official forum for the Chipmunk2D Physics Library.
Post Reply
murad357
Posts: 2
Joined: Tue Nov 13, 2012 3:48 am
Contact:

Sliding Puzzle

Post by murad357 »

Hello,

I am very new to iPhone game development. I have just finished reading Steffen Itterheim's book on cocos2d. And I have created the 3x3 sliding puzzle game (number) without chipmunk (just for learning purposes); by changing the Sprites texture and keeping a 2 dimensional array to hold data.

I am just wondering if it would be possible to implement that using the chipmunk?

If someone can give me some idea on how to proceed that would be great. I think I can create the space to hold all 9 Sprites (tiles/block), where one tile is empty and the sprites are movable there ..... but my questions are

1) How do I shuffle/scramble the tiles/number blocks (do I still need to keep the 2 dimensional array for that)?
2) How do I determine when the puzzle is solved?

3) Is there any other better way to implement this using chipmunk?

Thank you in advance

- Murad
Attachments
Sample screen shot
Sample screen shot
Untitled.png (5.39 KiB) Viewed 3108 times
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: Sliding Puzzle

Post by slembcke »

Honestly, I wouldn't implement this sort of thing using a physics library for anything other than a gimmick. You'll just end up having blocks get caught on all the corners and a number of other issues. If you really want to do it, scramble the blocks before setting up the physics.

Chipmunk can't help you figure out if the puzzle is solved.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
murad357
Posts: 2
Joined: Tue Nov 13, 2012 3:48 am
Contact:

Re: Sliding Puzzle

Post by murad357 »

Thank you for the reply.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests