Hi, does it displace until you stop moving, or displace and screws it up completely? It sounds like either one of the updates you broadcast are not coming through, or the updates are based on the wrong offsets. I assume that if you move a group of 3, the 2 that should be moved automatically ARE displaced by the same amount? Just a shot in the dark here, but when you broadcast to the group, do you skip the source of the event? For example, normally in a group of 2, when you move one, you could either: 1) move the one you moved and dispatch an event to the other 2) create an event and dispatch to the group 3) move the one you moved and dispatch an event to the whole group
the 3rd option clearly is invalid, since one piece would be moved twice. And with respect to the somefrogs.com, i had the same impression you had now "how do they do that" a few weeks ago, and now i know: one step at a time:). Once you have the mask, and the movement correct, you are 80% there;) good luck! JC On 7/11/06, Guntur N. Sarwohadi <[EMAIL PROTECTED]> wrote:
Hi Hans, Hmm.. I'm not sure what was I thinking when I was writing about onEnterFrame, coz like you describe earlier, I didn't use any onEnterFrame either.. gosh, this what happens when you don't have enough coffee with you after 2 days of no sleep :p.. well, anyway, in onMouseMove, I broadcast to piece group members to move as well, with the current piece as reference. Currently I calculated the distance prior broadcast and as the current piece moves, the piece group members would move in the same way without getting off location... but it does.. when you move the mouse fast enough, it displaces.. somefrogs.com... wow! that's so cool.. How you do such a thing?.. it blends in and mostly, the pieces dont fall off when you move the mouse fast enough!... how the...?.. anyone got an idea with my problem? thx! [g] On 7/11/06, Hans Wichman <[EMAIL PROTECTED]> wrote: > > Hi, > with respect to the combining pieces, why would you use onEnterFrame to > update the other pieces? > Of course I dont know the details of your implementation, but it would > seem > that if you had puzzle clumps (in want of a better term), meaning groups > of > already combined pieces you could either temporarily parent (meaning > recreating) the whole clump in a parent clip, and move the parent clip or > do > something like: > > puzzlePiece.onMouseMove = { > get self.deltaxy > if Puzzle.getGroup(self) == null then self.move(deltaxy) > else Puzzle.getGroup(self).move(deltaxy); > } > > With respect to the masking and filling through the drawing api, my > routine > looks like (in pseudo): > canvas.clear() > canvas.beginFill() > drawTop(canvas);drawRight(canvas);drawBottom(canvas);drawLeft(canvas); > canvas.endFill(); > > each draw routine picks up where the first left off, creating a closed > shape > which can be filled as normal. > > However if you had different sides drawn as vectors in flash, and convert > them to a symbol, and put four of them together, you can't do this, since > 4 > symbols together of course dont make a closed 'shape'. > > One other thing though: did you know this one: http://somefrogs.com/ > It might be all you need. It lacks a nice bevelled edge around the pieces, > which would have been easy to add to your drawn shapes, using a > bevelfilter, > but it still is a very nice out of the box reusable puzzle component I > think. > > greetz > Hans > > > On 7/11/06, Hans Wichman <[EMAIL PROTECTED]> wrote: > > > > Hi, > > with respect to the combining pieces, why would you use onEnterFrame to > > update the other pieces? > > Of course I dont know the details of your implementation, but it would > > seem that if you had puzzle clumps (in want of a better term), meaning > > groups of already combined pieces you could either temporarily parent > > (meaning recreating) the whole clump in a parent clip, and move the > parent > > clip or do something like: > > > > puzzlePiece.onMouseMove = { > > get self.deltaxy > > if Puzzle.getGroup(self) == null then self.move(deltaxy) > > else Puzzle.getGroup(self).move(deltaxy); > > } > > > > With respect to the masking and filling through the drawing api, my > > routine looks like (in pseudo): > > canvas.clear() > > canvas.beginFill() > > drawTop(canvas);drawRight(canvas);drawBottom(canvas);drawLeft(canvas); > > canvas.endFill(); > > > > each draw routine picks up where the first left off, creating a closed > > shape which can be filled as normal. > > > > However if you had different sides drawn as vectors in flash, and > convert > > them to a symbol, and put four of them together, you can't do this, > since 4 > > symbols together of course dont make a closed 'shape'. > > > > One other thing though: did you know this one: http://somefrogs.com/ > > It might be all you need. > > > > greetz > > Hans > > > > > > > > On 7/11/06, Guntur N. Sarwohadi <[EMAIL PROTECTED]> wrote: > > > > > > Thanks guys for the reply. Now I have a better understanding on how to > > > achieve the effect. Currently i'm planning to provide vector puzzle > > > pieces > > > as mask templates first. Once that's done, I would try to start > working > > > on > > > dynamically drawing the puzzle nubs and cutouts.. I like the review > Neo > > > handed. It explains a lot what Hans described... One question though, > > > whether the sides are drawn by code or provided as vectors, how would > > > you > > > combine 4 of them to make it as a filled masked vector shape using > > > drawing > > > api? > > > > > > One other thing, the puzzle I'm doing would allow users to move puzzle > > > pieces and combine them by side references (like, piece A is always in > > > the > > > left of piece B, while D is always below A, for example). Now I've > > > manage to > > > make each piece move other pieces in one group as a whole (using > > > onMouseMove > > > for the dragger and onEnterFrame by calculating distance with the > > > dragger > > > for the 'dragee') but it seems unoptimized and often lags (which > shifts > > > pieces location) if you move the mouse fast. It would look unsticky. > > > Does > > > anyone have an idea for a better algorithm? > > > > > > thx, > > > Guntur N. Sarwohadi > > > > > > PS. Neo, hows the TGB Isometric Add-On doing? :p > > > > > > On 7/11/06, neo binedell <[EMAIL PROTECTED] > wrote: > > > > > > > > Try something like this > > > > > > > > http://www.cedesign.com/cefx/reviews/reviews1_avbros.html > > > > > > > > ~neo > > > > > > > > -----Original Message----- > > > > From: [EMAIL PROTECTED] > > > > [mailto: [EMAIL PROTECTED] On Behalf Of > > > Guntur N. > > > > Sarwohadi > > > > Sent: 06 July 2006 03:15 AM > > > > To: Flashcoders@chattyfig.figleaf.com > > > > Subject: [Flashcoders] jigsaw puzzle piece algorithm > > > > > > > > I'm working on a puzzle game in flash, much similar to jigsaw > puzzles > > > you > > > > see in gameHouse or such casual game publisher. I'm having a hard > time > > > > > > > trying to cut an image to make it as puzzle pieces in AS2. Currently > > > I'm > > > > doing it the hard way, cloning bitmapData image, and masking > portions > > > of > > > > the > > > > image. Can you cut parts on an image using bitmapData methods? And > > > does > > > > anyone know how to create the infamous jigsaw pattern to it as well? > > > > > > > > Many thanks, > > > > Guntur N. Sarwohadi > > > > _______________________________________________ > > > > Flashcoders@chattyfig.figleaf.com > > > > To change your subscription options or search the archive: > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > Brought to you by Fig Leaf Software > > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > > http://training.figleaf.com > > > > > > > > _______________________________________________ > > > > Flashcoders@chattyfig.figleaf.com > > > > To change your subscription options or search the archive: > > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > > > Brought to you by Fig Leaf Software > > > > Premier Authorized Adobe Consulting and Training > > > > http://www.figleaf.com > > > > http://training.figleaf.com > > > > > > > _______________________________________________ > > > Flashcoders@chattyfig.figleaf.com > > > To change your subscription options or search the archive: > > > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > > > > > Brought to you by Fig Leaf Software > > > Premier Authorized Adobe Consulting and Training > > > http://www.figleaf.com > > > http://training.figleaf.com > > > > > > > > _______________________________________________ > Flashcoders@chattyfig.figleaf.com > To change your subscription options or search the archive: > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > > Brought to you by Fig Leaf Software > Premier Authorized Adobe Consulting and Training > http://www.figleaf.com > http://training.figleaf.com > _______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com
_______________________________________________ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you by Fig Leaf Software Premier Authorized Adobe Consulting and Training http://www.figleaf.com http://training.figleaf.com