[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] puzzle piece problem.



ok so you are saying to have it set so that the code morphs each line
instead of having it morph the fraction of the image as a whole....
so instead of having the piece morphed set up a code that morphs the
east line with so much of a curve that it looked like a
whole...........   I was looking into this and thought of a very
abstract way to do it but i doubt if it would work...... what if i set
up a template say in photoshop or GIMP and made that a reference or
outline link for what the code should represent.
  i.e create a grid that would form the piece given links to the image
that i created.
i was able to find a guide where a person set up an image with
different pointers for the mouse in the game... and had code that when
something happened the pointer would change given the place it pointed
to on the image.... I am currently trying to find that guide now...
does anyone think that would be possible.


On Nov 7, 2007 11:35 AM, Dan Krol <orblivion@xxxxxxxxx> wrote:
> Hmm. I may not be the most versed in this, but my impression is that
> it would be hard to represent a jigsaw piece with a continuous
> function, such as a sinusoidal. I think you might want to do it
> piecewise; straight lines and part of a circle.
>
>
> On Nov 7, 2007 9:31 AM, Joseph king <king.a.joe@xxxxxxxxx> wrote:
> > hey it is me again on the same issue..... thanks for the help but now
> > i am on to something a little easier if you program a lot.
> > My issue now if you saw the code that i had which i will repost on
> > this...... creating a "cookie cutter" to cut out the puzzle piece
> > shape of where the user wants and size/shape the user wants......
> > but i seem to be having an issue with this line of code
> >
> >
> > Def curvature_func(pos, eb_size, xmod, ymod):
> >       #A general curve to the piece kinda like a wavy line.
> >       state1 = float(pos) / float(xmod) * twopi
> >       state2 = float(pos) / float(ymod) * twopi
> >       state3 = float(pos) / float(xmod+ymod) * twopi
> >       state4 = float(pos) * (2.0/3.0) / float(xmod) * twopi
> >       state5 = float(pos) * (-12.0/5.0) / float(ymod) *twopi
> >
> >       bgen = math.sin(state1) + math.cos (state2) + math.sin(state3)
> >       bgen = bgen - mat.cos(states4) + math.cos(state5)
> >
> >       scale = (eb_size / 5.0
> >       bgen = (bgen * (scale*0.9))
> >       return int(bgen)
> >
> >
> > seems that it only creates a very slight wave on the edge of the
> > image.  but no matter what i change it does not really give me a
> > jigsaw like shape.
> >
> > does any one have any suggestions on a better way to make it more jigsaw like.
> >
>