How do I generate a path between points?

0 favourites
  • 13 posts
From the Asset Store
Move around the rectangular and travel as much as you can!
  • I have a layout in which a 2D platform terrain is generated, by using the random feature, very basic stuff really. It produces points at different heights which I hope to turn into a terrain. However, with these base points plotted, I can't figure out how to connect them, I would like to be able to connect them smoothly, but being able to connect them at all would be a great improvement. This is my .capx file.

  • Anyway to post your capx without the "spline" plug in?

  • Oh my bad, I thought it might have helped me, but It just gave errors. Forgot I left it activated. same link should work with the new version.

  • Well, I'd say the easiest way is to give your Line Sprite the bullet behavior and point it at the next point in line. Then have it spawn another point while it is moving along it's path. Destroy the Line when it hits the next Point. This will "Draw" points along the lines path. Now, it wont be "smooth", but it will connect your dots.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How would I specify which point it is to point at, they're all the same object?

  • You could use UID (Unique ID) or IID (Instance ID) to specify which point is next. So, as you create points along your path, the first one would be Point(0), the second would be Point(1) etc.. You could have Point(0) spawn a line and point your line sprite to Point(1).X / Point(1).Y

    There are some good tutorials about the use of UID and IID. Also, the manual explains them pretty good too. They are very helpful.

  • If I were to spawn a line on the first instance of 1, how would I tell construct I want it on instance 1, all I can seem to be able to do is just use the main group, not the individual instances?

  • If you want to spawn an object on Point instance one, on a new event line:

    Pick nth instance: and choose Point, then 1.

    Then have Point spawn another object "Line" at Point.x/Point.y

    To point the newly created line at the next instance, align "Line" to Point(2).X/Point(2).Y <-- (it's actually typed this way) Check the UID/IID example for a more detailed explanation! Good luck!

  • I have this yet still it does not work..

  • It looks like you are using a Spline Plugin. I haven't used that, so I couldn't tell you if what you posted would work or not. I'd check with the author of the plugin just to be sure.

  • Here is a .capx for you.

    dropbox.com/s/ajext92wiwcqszb/PointLineTerrain.capx

    I believe this is what you want. I also set the origin of the Line sprite to the left side so I can set it's width to the distance between itself and the next point. I added a few more things. Variables so you can change the spacing between each point and the scale (min/max height) of each point in the terrain.

    I added a DestroyOutsideOfLayout to the Point sprite. I couldn't figure out how to break the point spawning loop once the edge of the screen was reached. Any ideas from anyone else on how to fix that?

    Hope this helped.

  • I now have thisand I don't see why it shouldn't work, it should spawn a green dot between each point, but it doesn't.

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