# Railed Train Problem D:

Get help using Construct 2

### » Tue Aug 20, 2013 12:29 am

Hi there! I'm making a train that goes back and fort in a set of tracks.
I have most of it done. It's for an RTS game, so first the stations are placed; A, then B.
When B is being placed the game automatically shows what that tracks would be (from A to B)

Then Station A creates a Train cart. And the cart moves to B, when it reaches B, moves back to A, and so forth.

However, I haven't been able to come up with a way to make the cart stay on the tracks T_T, nor how to make an actual train (carts moving together, My train is 1 cart long T_T)

Any suggestions, ideas, solutions, would be really appreciated!

TRAIN CAPX
Sargas2013-08-20 00:30:11
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

### » Tue Aug 20, 2013 12:43 am

The carts seem to stay on the track quite well already.

For multiple carriages maybe... this
B
52
S
21
G
92
Posts: 2,405
Reputation: 54,498

### » Tue Aug 20, 2013 1:05 am

Thanks! but it's a train xD it shouldn't turn around like it currently does, it should get there, stop, and then come back in reverse.

Also... the carts stays somewhat on the rails only while going from A to B (as the track were calculated that way) but when it comes back it calculates B to A, and chooses a different path.

Besides, I need this to be 100% reliable. As the capx says inside, I though maybe using the nodes to "manually" tell the train it's path might work, but I don't know how to do that D:

I think what it needs to do is have a variant that defines if it's going forward or in reverse along the rails (or nodes), and that's how the train knows which one is the head, the other 2 carts should he "pinned" to the head.
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

### » Tue Aug 20, 2013 1:10 am

Ah I see what you mean. I did try pinning before that idea and it ended up a little messy. Yeah you could just make the head A and pin the rest to it. when it reaches station B, clear up the pinning so then C-B-A is the new order and have C find path to s1.x,s1.y
B
52
S
21
G
92
Posts: 2,405
Reputation: 54,498

### » Tue Aug 20, 2013 2:27 am

V.3

I think I got closer to make the train follow my Nodes, but it doesn't work D:

when there are 0 nodes, i told it to go straight from A to B, which works fine.

but when there are nodes, it only goes to 0 then stops moving.

Obviously i did something wrong, could someone take a look at it? D:
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

### » Tue Aug 20, 2013 3:24 am

V4

OK! I actually solved this thing! (almost xD)

now all i need to do is have the other 2 carts form a train... (which is a lot harder than it seems....)

any help with this last part? D:Sargas2013-08-20 04:14:52
B
43
S
12
G
6
Posts: 446
Reputation: 6,807

### » Tue Aug 20, 2013 4:29 am

I think, at this point, I won't mess with the mechanics of the train and just place a fake train on top of it :D

Still don't know how though, any ideas?
B
43
S
12
G
6
Posts: 446
Reputation: 6,807