0 Favourites

How do I make curved lines between dots?

  • I have to trace lines between dots, but they should be curved, what is the best way to do it?

    Link to capx - . I want to draw roads and rivers over the map.

  • The best way to do it is to use bezier curves, they are rather intuitive. Look up the math on wikipedia. Depending if you just need simple curves or very windy paths you can use more control points.

    However drawing good looking curves in C2 is not exactly easy. The best I could come up with is using small sprite sections, calculating the slope at the point in which the section is placed, rotating it to the angle of the slope and so on. Unfortunately you easily end up with hundreds of sprites just for that. That might impact performance. Maybe there is a plugin that does that better.

    However if you just want calculate a curve and translate it into a set of tiles constituting a path that you autotile, the whole thing become much simpler. No need for calculating the slope, sprite/object count goes down.

  • As Pulsar suggested, you can try Bezier curves. I already made this couple of months ago. If you can understand what is there, you could implement this in your game. replace the dots with lines .

    And as for performance goes, if you don;t want many sprites, just use the Paster or Canvas plugin and only "bake" the curve/path line into that object, then delete the curve/path

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • As Pulsar suggested, you can try Bezier curves. I already made this couple of months ago. If you can understand what is there, you could implement this in your game. replace the dots with lines .

    And as for performance goes, if you don;t want many sprites, just use the Paster or Canvas plugin and only "bake" the curve/path line into that object, then delete the curve/path

    I can't find the plugin SeedRandom, the file is deleted. If it is possible please attack the plugin.

  • redownload the file again. I deleted the plugin from the projects, since it doesn't use it

  • It takes a fair bit of math to generate a smooth-closed curve from only points. Here is an example using cubic-bezier curves, as mentioned by Cipriux.

    http://www.blackhornettechnologies.com/Construct2Stuff/bangoo_beziercurves_BHT.capx

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