[SOLVED]How do I make roller coaster loop?

0 favourites
From the Asset Store
For Adventure, Action, Heroes, Sci-fi and Action-RPG games.
  • Hello World,

    Ok, check my super horrible drawing below. I wanna have an object that on created(I'll probably want to be able to create it in random positions, I know how to do this part) will move a certain distance from point A to point B and along the way will perform one(or more) of those loops like you see in roller coasters.

    Any idea how I can do this please? I haven't a clue even what behavior to use(sine, litetween, pathfinding, splinepath, etc.) or how the events would go....

    Thank you.

  • Is point B can move (or is it fixed?) while the object is moving?

  • Once the object is created point B would be chosen and stays fixed while the object is moving MadSpy . And idealy after the object reaches point B it goes back(following the same path) to point A, then from A again to B and so on.

  • I would divide the line up into a series of points (the more points, the smoother the motion would appear). Each point would be a way-point, and you could determine the angle difference between each point to tell your sprite to rotate as it goes around the loop...

    Each point should have a sequence number, so you can tell what the next (or previous) point should be...

  • Do you want something like this ? VIKINGS

  • Pretty much yeah MadSpy !^^ But can it do the loop every time it goes back and forth?

  • Yes, he can.

    Let me 5 min to see if I can do this in less of 20 events and without plugins

  • Link updated VIKINGS

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, that's it, it's perfect! Thank you MadSpy , send me a capx please.

  • If you can't wait, I'll share the capx as is

    Link

    EDIT:It's not fully optimized. You need to upgrade the code in order to use this with multiple spMovingBlock.

    I've already add the random place to the roller loop, you just add the link between the 4 objects

  • Oh, no problem, sure I can wait MadSpy . I have to go to bed soon anyway. So work your magic some more on it please and I'll grab it tomorrow. Cool?

  • I only have a few months of experience with C2. The real magic comes from other well-known users. They will intervene if necessary .... or if I say stupid things lol

  • Loool, we'll I've been using C2 for over a year and you still seem to know more then me... That's sad....

    Oh well, guess I'll turn in and have some nightmares where pieces of code with huge teeth chase me around trying to eat me(seriously I've had this one several times already)....

    So good night MadSpy , I'll check the capx tomorrow, can't wait to see what you do with it untill then.

  • I tried a slightly different approach... you draw a line by holding down the left mouse button. When you stop drawing, an airplane is created on the line and follows it.

    as the line is drawn, it is divided into a series of "nodes" or segments. Each node knows where to find the next and previous node. (a value of -1 marks the beginning or end of the chain - the plane reverses direction when it hits an end.)

    The code is very messy. The plane follows the line exactly as it appears, and sets the plane's angle to the angle of each segment - so the motion is not very smooth. I would want to either automatically smooth the line after it has been drawn, or have the plane smoothly transition from the angle of one segment to the next, and probably would do both... I also briefly thought about having the capx export the node list in json format so that a path could be easily imported into another project for an object to follow.

    You can draw multiple lines. There is a speed variable if you want the planes to move faster. There is a lot of room for improvement! : )

    you can download the capx here: http://www.rieperts.com/games/forum/follow_line.capx

  • Thanks AllanR , but I need for the whole thing to happen under the hood, the player isn't supposed to draw/set anything.

    So I'm just gonna wait for MadSpy to finish optimizing his capx, he seems to be going in the direction I want.

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