Sidescroller - Minecart - Railsystem - How to move along rails with intersections?

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

    i am currently programming a little sidescroller game where the player can build rails and use a "minecart" to fasttravel. The rails are placed on a 128 x 128 grid.

    For the minecart movement i tested

    - Platform behavior

    - Physics beahvior

    - Move to behavior

    Platform behavior worked the best so far but brings big troubles with intersections

    Physicsbeahvior is to wonky to be used here, also collision detection might be a problem.

    I found this thread whcih describes a move to behavior, which seems to be the best aproach, but even this seems to be a bit choppy when used at higher speeds meaning the "breaking" looks a "bit" off. Also it seems to be more suitable for a path which does not change... But with intersections is a different storry.

    So if the player presses down and there is an option to go straight or down the down path should be chosen.

    How would you solve this? Is there even a good approach to this? What would be your starting point?

    Physics seem to be nice, as the cart would roll down when on a hill or slow down when going up but it does not seem to be useable.

    Kind regards


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I imagine platform would be most suitable. What issues are you having with intersections and how did you set them up?

  • hey oosrag,

    the redlines mark the rails in the image

    I would really like to work with platform behavior, but so far i could not figure out how to handle the problem that the player has to go "through rails.

    I attached another examplepicture, lines go in both directions. I tryed to disable colliion for some when down / up is pressed but it turns out really messy and its very complicated (also did not work in each case)

    the red lines are from one sprite with different animationframes, the intersections are determinded automatically when placing the rales depending on the surrounding rails.

    So the big question would be how to handle the whole going up through a rail and falling down througha rail while keeping the momentum. I looked at different examples on how "going through stairs" but none of them helped yet. Thats why i ended up thinking a move to behavior would be better...

    Kind regards


  • This is mostly a case where left and right are constantly activated and speed set, while using jumpthrough for "rail" platforms and the fallthrough action should get you most of the way there, unless you are aiming for other specific behavior.

    Diagonals and high speeds can cause other issues you may need to work around that I'm not familiar with though.

  • Jea i tested a lot with those already but did not get a good result as mentioned... I have to simulate the "jumps" as the minecart cant really jump haha :D Well, i guess i could change it so, that the minecart can actually jump and you dont have those diagonal rails connecting... Not the best solution imho but it would be a solution i guess.

  • Why do you need jumps? It should normally go upwards on diagonals when you run into them.

    Edit: Check out one way solids -

  • Well yea you go upwards till you hit a wall (1)

    Thing is jump through does not work wenn you "run" into a ceiling haha :D

    One way solids are actually some starting point, i will play arround with it more, unfortunately most of the examples from the old posts are not there anymore :(


  • update: jump through really doesnt do it for me as i fall through the "rails" constandly even with pixel perfect positioning... i even tryed to modyfy the collision poligons and tryed different shapes... i dont think there is a good way to do this with the build in constrcut functions which is a shame :(

    It does not help much, that i can drive through rails from below now haha as i even fall through straight rails...

  • Sorry it's been a while since I worked with the platformer behavior. Messed around with it a bit and this is a more difficult problem than I originally thought. Platforming mechanics are always deceptively simple but actually quite complicated.

    To approach this I would probably want some additional hitboxes and special logic for "stairs".

    Additionally I think I'd have everything above the bottom of the character hitbox to not be solid until the bottom of the player collision box rises above the horizontal level of the top of any given platform.

  • Well, i tryed a lot more but its really really hard, especially as the jump through is very wonky :( also with the diagonal platforms its hard to do... I think my best bet would be to figure something out with move along path...

    Semms like this "bug" exists for a while now:

    I cant get it to work properly especially with fast moving sprites. No problems with this fall through with solid behavior but then i habe to figure the jump through out which is hard... The collision detection is kind of nuts and it seems like one cant set the stepping mode manually like with physics or bullet behavior. Currently ill try to create the movements with bulletbehavior which seems to be overly complicated :(

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