[SOLVED]How do I make roller coaster loop?

Get help using Construct 2

Post » Tue Aug 11, 2015 12:00 am

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?
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Tue Aug 11, 2015 12:06 am

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
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Tue Aug 11, 2015 12:13 am

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. :D
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Tue Aug 11, 2015 9:12 am

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
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Tue Aug 11, 2015 10:29 am

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.
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Tue Aug 11, 2015 1:44 pm

The manual drawing part with the mouse is just a way to test out different paths of various shapes quickly and to test concepts. It would be possible to randomly generate a path once you decide on basic parameters of what you want, or save a path after you have drawn it and add that to your game... (the path is just a series of points - most of the paths I was trying were about a dozen or two points.)

MadSpy is doing a great job on what you are specifically after, I have seen quite a few people asking about how to make an object follow a path, and wanted to play around with a more general solution to the problem. So I had a bunch of concepts rattling around in my head - like could the path adapt itself to avoid obstacles, apply physics to the object so that it accelerates downhill and slows down going uphill, etc... Its a fun exercise to experiment on! C2 never ceases to amaze me. : )
B
97
S
34
G
20
Posts: 438
Reputation: 17,790

Post » Tue Aug 11, 2015 2:36 pm

@AllanR for me the fun usually stops when smoke starts coming out of my hair when I can't figure something out, loool. ;)
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Tue Aug 11, 2015 10:27 pm

@VIKINGS
Link updated
press space key to create
press D key to destroy random instance
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

Post » Wed Aug 12, 2015 1:06 am

Hehe, very very nice @MadSpy !!:) I knew I could count on you. :D
One last question, can I change the speed it's traveling at, or is it tied to the distance it has to travel?
B
21
S
11
G
6
Posts: 414
Reputation: 5,335

Post » Wed Aug 12, 2015 7:09 pm

You want to change (increase or decrease) for each creation or for all objects at the same time?
Image Image
B
25
S
14
G
136
Posts: 876
Reputation: 71,005

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: brunopalermo and 50 guests