I am trying to make a simulation that allows a user to draw a track, and then drop a sprite on it that naturally follows the path that the ball moves. Like a rollercoaster where the passengers have no seatbelts, I want the ball to leave the track if it goes too fast over a hump, or leave the track if the ball is moving too slowly on an inverted section.
I have made some progress thanks to reading some clever posts by R0j0hound, but I am stuck on making the ball follow a loop.
Any advice you can offer would be greatly appreciated.
Link to file:
https:// dl.dropboxusercontent .com/u/81007120/Rollercoaster.capx
The acceleration when overlapping the wall should only be set if the wall is below the ball, otherwise it should just be down. If the wall's angle is between 90 and 270 the it's facing down. Also setting the velocity of the ball should only be done if the ball's velocity is moving toward the wall (this will provide the jumping).
Also it could help a bit if you correct the position of the ball so it pushes out of the wall.
There probably will be issues when the path crosses over itself. One idea could be to only check walls so far ahead and disable them as you pass or something.
You could probably get a similar effect with the physics behavior, but you'll still have to deal with the issue of the path crossing over itself.
Develop games in your browser. Powerful, performant & highly capable.
Thank you so much for the input!
I am still slow when it comes to this stuff, so it will probably take me a few days to trial and error through your advice, but I am super grateful for the tips.
I will be sure to post back here if I achieve success.