Copy link to clipboard
Copied
Hello, I am working on a game in which a ball will roll down platforms tilted at different angles (independantly, without user input), and I am unsure of how to construct the physics of the ball. I already have the platforms good to go, but I need help figureing out how to get the ball to move down them. I don't want it to bounce, I just want it to roll, and fall down on to the next, and so on. etc... This might not make a ton of sense, just ask if you have any questions. Any help on what the code would look like would be greatly appreciated. Thanks!
Copy link to clipboard
Copied
There's 2 concepts involved here, velocity (mass/gravity/angle/friction) and collision. The first part is easily faked using simple variables and a frame loop (larger the mass/angle the more the velocity, vice versa, all minus friction). The second part isn't quite so easy.
That said I strongly suggest you simply get a physics engine. Why reinvent your wheel?
Have a look here for plenty of 2d physics engines that will do this for you:
Find more inspiration, events, and resources on the new Adobe Community
Explore Now