Is there a possibility to draw a path?

  • Hello,

    just wondering if there is any possibility, to draw a path on which the object is moving instead of let it search for the shortest way.

    Thanks:)

  • yep

    interchange mouse and touch, but I like touch.

    If is in Touch

    Get Closest Node Sprite.

    Is node Sprite > 50px

    YES Then Create Node Sprite at Touch.xy. node.pathnum = node.count

    On Release

    Start PC Move

    PC Move

    Move PC towards nearest node

    upon overlap of Node.

    destroy node

    Start PC Move

    continuing on

    If Touch start

    node destroy all

    and that's the gist of it. size your node and distance however you want.

    I would say 99% of the time the question isn't "Can C2 do feature X", but instead "Am I clever enough to figure it out."... the answer is yes given time.

  • jayderyu

    Hey, thanks for your answer :-)

    This sounds really interesting, but is not what i?m looking for :-D

    I want to create something like this. Moving platforms, that follow a route, icreate.

    <img src="http://i48.tinypic.com/2eq5q3d.jpg" border="0" />

    Have you got any tips for me? :) Pathfinding behavior isn?t really optimal I guess ( at least in the way I use it :-D )

  • how about something as simple as:

    find path, follow it ... every tick have the object moving spawn a dot ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It should?t draw a line. :)

    Maybe i?m explaining too bad haha :-D

    I want an object to follow a shape. Maybe a vector line or something like that line in the mario game. I want the platform to move exactly where I want it to, so that it looks like it is sticked to the line :-P

  • ah I see :)

    Something like an object which is able to move between two spots, and you can determine with player controls if the moving platform is going left or right along the given pathway ?

    I would place a simple line on the screen (floor), add a box/plate(wheree you stand on) with platform behaviour on top of that, controls intially disabled.

    And as soon as your character lands on the platform, transfer default controls from your character to the platform and pin your char to the platform, and limit movement to left and right. (steers platform)

    When you press something like jump, you could unpin and swap the controls again finishing by a jump command.

    Something like that ?

  • lennaert

    Gosh, what great ideas, but not what I was exactly looking for :)

    My game will be top down, the Mario plattforms were just examples.

    I made up something to make it clearer:

    What I want now, is to let an object follow these laserlines in endless circles. I tried pathfinding behaviour and filled the whole screen with invisible solid sprites, but it acts somehow weird.

    Really hope that you can help me now, it's essential for my whole project:-)

    Thx a 1000 times friends :)

  • Give your main object custom movement and put an invisible target object at each corner of the path. Give each target a variable that allows you to number them in sequence in the layout editor. Using events, pick the correct target by filtering for the correct variable value and then set your sprite to track towards it. Then, on collision with the target just as 1 to the target variable value, unless you're at the end when you reset to the start.

  • Take a look at This topic and specifically rojohounds example, which has been edited for later construct versions on the second page by Ramones.

  • Actually. My example still follows the same principles.

    Create a set of nodes. ID them for a follower. Then move the platform node to node. Even if your not drawing them, but instead creating them during edit time.

    I would however add a criteria of naming the platform and path so that platforms stick to there path nodes.

    You could use the idea of following a vector line, but it's over kill for a Mario like platform game.

    You can also give the nodes instructions.

    Forward. move the platform in a count up ward path.

    Back. Send the platform on a backward count down path.

    drop. have the platform fall off the screen.

  • Thanks for all your help people, you are absolutely great! :)

    I?ll try all the stuff you suggested tomorrow.

    Just a thought...

    Couldn?t I just add invisible objects at 45 degrees and the bullet behavior, or will it not stay in the brackets and fly out of layout? Thinking about physic rules, it should work, shouldn?t it?

  • Yes, thanks a lot for this stuff :)

  • Frostolo

    Cool :) Which solution worked out best for you?

  • Hey guys, just want to let you know, how i solved it.

    I used the bullet behavior and created four invisible sprites called Up,Down,Left,Right....then I made walls from them and changed the direction of bullet behavior in the correct way. Works super fine! :)

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