I would like to make a train in my game that the player can controll. It is not like a normal train that rides on rails, thie would be simular to a child's pull train that just rolls along the ground. My problem is making and controlling the cars they need to stop when their corners touch and also they need to maintain a set distance from each other at all times. It would be simular to a chain except the links are always a set distance apart.
Here are the specs:
Each car measures 16x24 pixels. The space between the ends of the cars is 4 pixels. Cars need to never intersect, even when the train changes direction. If you can maybe help me I would be really gratefull. I doubt that I can solve this on my own. I do have a function to draw the rotated rectangles, you only need to help me find the midpoints of each car....
Here is a pic to help with the concept:
Here are the specs:
Each car measures 16x24 pixels. The space between the ends of the cars is 4 pixels. Cars need to never intersect, even when the train changes direction. If you can maybe help me I would be really gratefull. I doubt that I can solve this on my own. I do have a function to draw the rotated rectangles, you only need to help me find the midpoints of each car....
Here is a pic to help with the concept: