Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need Help giving a ball gravity & friction (AS3)

New Here ,
Apr 02, 2014 Apr 02, 2014

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!

TOPICS
ActionScript
551
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 03, 2014 Apr 03, 2014
LATEST

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:

http://tomkrcha.com/?p=1086

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines