-
1. Re: how to split bitmap for jigsaw game?
Andrei1 Jul 31, 2010 7:04 AM (in response to polatkanfatih)This is not difficult when you get your hand on BitmapData class.
Create puzzle pieces as vector graphics (in Illustrator ?) - they will serve as templates --> copy original bitmap's corresponding parts channel (BitmapData copyChannel method) into these shapes --> viola! you have your bitmap split.
But, again, you need to know how to manipulate BitmapData. There are many tutorials on the web.
-
2. Re: how to split bitmap for jigsaw game?
polatkanfatih Jul 31, 2010 7:30 AM (in response to Andrei1)i am familiar with your opinion, but what if i want to create vector templates dinamically?
how could it be done?
-
3. Re: how to split bitmap for jigsaw game?
Andrei1 Jul 31, 2010 8:07 AM (in response to polatkanfatih)Well, this is a lot of Math if you want templates to be as elaborate as regular jigsaw pieces with curves, etc.
Of course it is possible with drawing API but you need an algorithm. I suspect you won't find this algorithm here though. Google search for math of jigsaw puzzles yields results that demonstrate complexity of the issue. Some even have PhD papers on it.
-
4. Re: how to split bitmap for jigsaw game?
polatkanfatih Jul 31, 2010 8:19 AM (in response to Andrei1)understand...
thanks...
-
5. Re: how to split bitmap for jigsaw game?
kglad Jul 31, 2010 8:29 AM (in response to Andrei1)it's not complex to create a jigsaw puzzle. it's complex (and there's a real-world need for) developing algorithms that can reassemble a jigsaw puzzle.
-
6. Re: how to split bitmap for jigsaw game?
Andrei1 Jul 31, 2010 9:16 AM (in response to kglad)kglad, how would you approach it conceptually? I mean, how would you create a continues series of random shapes that fit into each other? I am talking about complex shapes with rounded and tilted edges.
-
7. Re: how to split bitmap for jigsaw game?
polatkanfatih Jul 31, 2010 9:21 AM (in response to Andrei1)i dont know either. i didnt think deeply but maybe it can be made by some code standardization. there is already curve drawing API, it can be used to create patterns. but it doesnt easy of course.
-
8. Re: how to split bitmap for jigsaw game?
Andrei1 Jul 31, 2010 9:38 AM (in response to polatkanfatih)Well, I suspect that maybe with enhanced FP10 drawing API there are more efficient ways to do that. I just did not have a chance to try it out.
Conceptually, pieces must share sides. But before that sides drawing should have some sort of algorithm that not only accommodates curvatures/circle segments/angles but also randomize these parameters.
This is an interesting riddle though...
-
9. Re: how to split bitmap for jigsaw game?
kglad Jul 31, 2010 12:45 PM (in response to Andrei1)oh, i don't think it would be easy to create a dynamic jigsaw puzzle in flash (but it's doable). i meant the rigorous treatment of jigsaws is about assembling them. creating jigsaws is a trivial (though not necessarily easy) task.



