Bezier curves

0 favourites
  • 6 posts
  • Does Construct have a way of creating curves or bezier curves for objects to follow?

    Thanks

    Kosh

  • Wow, this is great, thank you..

    Now, can you explain it to me?

    How did you know how to write this?

    the equations, etc..

    Like line three in the event sheet..

    Oh and yeah, the next part, drawing the line, qarp, all that.. is that JS coding?

    And math formulas? lines 4-7>

    I know very little so Iam asking a lot of logic questions of

    everyone.. finding out the thought process I need making games and doing expressions/code when needed, its just learning how to do that.. art is easy.. this.. has got my attention..

    Is it possible to adjust the arc of the curve? round it more at the top?

    Thank you again, so much!

    Kosh

  • So the qarp(a,b,c,t) expression is the basis for that. With one for x and y you will get a quadratic Bézier curve. A and c are the endpoints and b is a control point in the middle. Typically the curve will not touch the middle control point but newt is utilizing a little additional math to have the control point be on the curve.

    Anyways, the t is a value from 0 to 1 to get any point along the curve.

    Basically this is how you’d create points along the curve.

    Repeat 10 times

    — create at qarp(ax,bx,cx,loopindex/10), qarp(ay,by,cy,loopindex/10)

    Newts example draws lines between them with canvas and adds them as waypoints for the move to behavior to move along the curve. Conceptually you can think of the curve getting approximated by multiple lines that are moved along in series. That was done so the speed would be constant. If you alternately just changed t over time and used the qarp expression you could have a more precise curve but the speed would vary.

    The shape of the curve is limited by those three control points. You could use cubic() instead to get one more control point to give finer control. There are other ways to do curves between points too, but you’d have to write the whole equation out.

    All that in the example was just expressions. No js used there.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • ^ what he said.

    Also you can make pre defined curves with Timelines.

  • newt and R0J0hound,

    Thank you both!

    So very much appreciated!

    Thank you both for taking the time to help me on this..!

    Gonna be a busy week..

    Kosh!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)