Beizer Curve Tutorial?

I am planning to buy Level Director for a top down racing game I am making. How would I make a beizer curve and make ai cars follow them? I know how to make a beizer curve, but how do I make cars follow it in my code???

Hi,

If you take a look at the Bezier example project that is installed in the documents\level director\Examples folder you will find some code that demonstrates this.

The basic concept is to get the x,y points from the curve in some kind of frame event and set your sprite coords accordingly, similar to this;

--get local copy of curve and ball from level local curve = myLevel.layers["BezierLayer"].objects["bezier\_1"].curve local ball = myLevel.layers["BezierLayer"].objects["ball"] local pointInc = 0.00 -- move ball along curve and then stop local function follow (event )&nbsp; if pointInc \< 1.01 then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ball.x, ball.y = curve(pointInc)&nbsp;&nbsp; pointInc = pointInc + 0.01&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Runtime:removeEventListener("enterFrame",follow)&nbsp;&nbsp;&nbsp;&nbsp; end end Runtime:addEventListener("enterFrame",follow)

Hi,

If you take a look at the Bezier example project that is installed in the documents\level director\Examples folder you will find some code that demonstrates this.

The basic concept is to get the x,y points from the curve in some kind of frame event and set your sprite coords accordingly, similar to this;

--get local copy of curve and ball from level local curve = myLevel.layers["BezierLayer"].objects["bezier\_1"].curve local ball = myLevel.layers["BezierLayer"].objects["ball"] local pointInc = 0.00 -- move ball along curve and then stop local function follow (event )&nbsp; if pointInc \< 1.01 then&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ball.x, ball.y = curve(pointInc)&nbsp;&nbsp; pointInc = pointInc + 0.01&nbsp;&nbsp;&nbsp;&nbsp; else&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Runtime:removeEventListener("enterFrame",follow)&nbsp;&nbsp;&nbsp;&nbsp; end end Runtime:addEventListener("enterFrame",follow)