2 Replies Latest reply on Mar 4, 2008 2:46 PM by McFazstp

# bezier curve for quad path

hello everyone

i have the following code which im using to move an image from one quad to
another. Currently its moving in a straight line. I want the path to be more
attractive. I hear i can manage it by integrating a bezier curve.

I hope someone could show me how i could do that.

Any help is appreciated.

thanx

ahmed

Heres the code

property sp

property pnt1startx, pnt1endx, pnt1starty, pnt1endy

property pnt2startx, pnt2endx, pnt2starty, pnt2endy

property pnt3startx, pnt3endx, pnt3starty, pnt3endy

property pnt4startx, pnt4endx, pnt4starty, pnt4endy

property p

on beginSprite me

p =0

sp = sprite(me.spriteNum)

-- point1

--point2

--point3

-- point4

end

on mouseup me

p = p + .01

pnt1x = p * (pnt1endx - pnt1startx) + pnt1startx

pnt1y = p * (pnt1endy - pnt1starty) + pnt1starty

pnt2x = p * (pnt2endx - pnt2startx) + pnt2startx

pnt2y = p * (pnt2endy - pnt2starty) + pnt2starty

pnt3x = p * (pnt3endx - pnt3startx) + pnt3startx

pnt3y = p * (pnt3endy - pnt3starty) + pnt3starty

pnt4x = p * (pnt4endx - pnt4startx) + pnt4startx

pnt4y = p * (pnt4endy - pnt4starty) + pnt4starty

sp.quad = [Point(pnt1x,pnt1y), point(pnt2x,pnt2y), point(pnt3x,pnt3y),
point(pnt4x,pnt4y)]

if sp.quad = desQuad then exit repeat