How do I make a Train (On-Rails movement) ?

0 favourites
  • 6 posts
From the Asset Store
Create a game inspired by great arcade classics as Operation Wolf
  • Hello,

    I am trying to make a car move on a preset path, like a trail, with turns and the ability to accelerate/decelerate. What is the best to do it, please?

    - Tried the Car behavior, it worked with some speed values, but when trying to accelerate, the new speed cause the car to leave the trail.

    - Tried the MoveTo behavior, making the car move from one section to the other, but it looked clunky and not smooth like the Car behavior (but it has more control over the car).

    - Tried using EveryTick to move the car based on math calculations. The straight lines were easy to do, but the curves were tricky.

    What is the best to do it, please?

    Thank you.

  • Here's a few ideas:

    An idea to make up track of modular pieces. Straight and perfect arcs.

    dropbox.com/s/quzp15smcjkljd4/train_wip2.capx

    An idea to move along a Bezier curve. The curve is converted to a polyline to ensure constant speed along the curve.

    dropbox.com/s/m0pk8zvqoj08kr7/move_on_dashed_curve.capx

    A slightly different way. It skips the polyline conversion step and still gives relatively constant speed even when nodes aren't evenly spaced. For a curve loop.

    dropbox.com/s/6mu2yolmavp5ap9/followSpline.capx

  • I learn that in first example it is makes sense using direction angle between 90 and -90 which is utilize facing & angle degree at once. Nice & modular.

  • Here's a few ideas:

    An idea to make up track of modular pieces. Straight and perfect arcs.

    https://www.dropbox.com/s/quzp15smcjkljd4/train_wip2.capx?dl=1

    An idea to move along a Bezier curve. The curve is converted to a polyline to ensure constant speed along the curve.

    https://www.dropbox.com/s/m0pk8zvqoj08kr7/move_on_dashed_curve.capx?dl=1

    A slightly different way. It skips the polyline conversion step and still gives relatively constant speed even when nodes aren't evenly spaced. For a curve loop.

    https://www.dropbox.com/s/6mu2yolmavp5ap9/followSpline.capx?dl=1

    Thank you very much :)

  • move-to can be moved along paths made with the timeline and these timeline path can have bezier curves.

    editor.construct.net official example project

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • move-to can be moved along paths made with the timeline and these timeline path can have bezier curves.

    https://editor.construct.net/#open=move-along-curved-path official example project

    Ah, right! Thank you!

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