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!
The carts seem to stay on the track quite well already.
For multiple carriages maybe... this
Develop games in your browser. Powerful, performant & highly capable.
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.
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
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:
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:
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?