ScratchData LogoScratchData
Back to ubrecma's profile

Planet Gravity 2

UBubrecma•Created January 17, 2013
Planet Gravity 2
20
16
1258 views
View on Scratch

Description

Run in Flash turbo mode. Fixed the "friction" issue; now the character bounces off planets! This is just a fun experiment with multi-planet gravity. No scrolling for now. It uses Newton's law of universal gravitation: F = G * m1 * m2 / r^2 Where m1 and m2 are the masses of the bodies, r is the distance between them, and G is the gravitational constant. This returns a scalar (a number) that represents the magnitude of the vector from the player, pointing toward the planet. If I add up all those vectors, I get a resultant force vector for the player that shows the combined effect of all the planets. Anyway, click in empty space to add a planet and determine its size, click on a planet to delete it. For this project, the mass of the planet is directly proportional to its area. Since the player's mass is unchanging and since F = m * a (where m is mass and a is acceleration), the force given by the gravity equation above effectively produces acceleration only (the quantity that we change velocity by). - amcerbu

Project Details

Project ID3042703
CreatedJanuary 17, 2013
Last ModifiedJanuary 17, 2013
SharedJanuary 17, 2013
Visibilityvisible
CommentsAllowed

Remix Information

Parent ProjectView Parent
Root ProjectView Root