How to automatically draw lines that will work as paths

0 favourites
From the Asset Store
solution for games like "fruit ninja" and drawing applications
  • In my game I want my code to generate random paths for an object to follow. The path should always go downwards, but occasionally divide into separate paths for the player to select.

    I have tried several approaches without luck, so I'm simply asking for a way to make this work best way possible. Only thing I can come up with is a tick loop that adds pixel by pixel, but I guess that would be a terrible way to do it?

  • Are you doing some kind of vertical scroller? Do these paths need to be contiguous?

    I've never worked with the Pathfinder object, but I can suggest mathematical ways to do this if you are interested.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • gumshoe2029 I don't think I'll need pathfinding for now. Just drawing lines vertically and occasionally split into two ways. I almost made a solution with bullet behaviour that shoot out lines, but now only got one vertical line. I might get this working, but I'm definitely open for better solutions.

  • Nice, put your solution here if you get it working. Thanks.

  • janlindso

    If I understand, you can simulate this by moving your object from A to B when angleAB=180° and AB is perpendicular to X axis

  • Still having a hard time to find a solution for this. Tried to make an animation to show what I want to create.

    • A sprite moving along a line (really in same position all the time)
    • If left button is pressed, then move to the left path
    • If right button is pressed, then move to the right path

    Have tried to do it with a line sprite shooting out bullets to create the path, but there must be a better way to do this?

  • I don't know if this is what you searching for, but I think it can be helpful. It's a blackhornet job, did with the LineTween plugin. ^^

    CAPX:

    http://s000.tinyupload.com/index.php?fi ... 4777992425

  • I don't know if this is what you searching for, but I think it can be helpful. It's a blackhornet job, did with the LineTween plugin. ^^

    CAPX:

    http://s000.tinyupload.com/index.php?fi ... 4777992425

    Thanks. It's pretty close, but still not it. This one makes the object move along the lines. I want the object to be at the same spot all the time, so I guess it must be the paths that moves and not the object itself.

  • Something like this ?

    (left/right arrow to change direction)

    EDIT: link broken see next post

  • Something like this ?

    (left/right arrow to change direction)

    Maybe, if only I'd get the link to work.

  • Demo

    my fault

  • Demo

    my fault

    Kinda, but without the main object moving from position (cant use scroll-to either as it has been use on another object already). So, only solution as I see it, is to make the path moving instead. Like in my gif example, the object never change position,

  • janlindso

    Link updated Demo

  • MadSpy

    Yes, this works! Not 100% sure if it will work in my project. How did you do it? Did you use any plugins?

  • The action is currently partially scripted... except for the part where the player chooses the path .

    no plugin

    Just a movement of lines according to the position and angle of the player (less than 40 events )

    The player followed the lines at each intersection in the first example .

    in the last version, the lines that follow the direction of the player ... I " just " reversed the process

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