Page 1 of 1

Sliding Puzzle

Posted: Tue Nov 13, 2012 4:08 am
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

Re: Sliding Puzzle

Posted: Tue Nov 13, 2012 9:24 am
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.

Re: Sliding Puzzle

Posted: Fri Nov 16, 2012 11:42 am
by murad357
Thank you for the reply.