If the magnetic toy trains are opposite charges, they will attract each other and collide however if the trains are of the same charge, they will oppose each other. This is because electrostatic force (the opposite forces so + and -) attract opposite charges
Hope that helps :)