When we click the flag and Up & Down keys, the train will move towards straight.
View this project in Scratch
Scratch