下载Scratch 其他 3 sprites and 4 描述 of "Gravity" and open it in Scratch
Project Notes
Simulation of two planets orbiting a star. Place the two planets in different starting places and watch as they interact with each other.
The planets don't orbit in exact elipses and instead sometimes create a spirograph-like orbit called precession. Some of that is due to floating point errors, especially if it gets close to the sun. The rest is due to the gravitation influence of the other planet.
Programmer's Tip:
I share the (x,y) position of each planet in global variables to calculate changes in acceleration. The sun is always at (0,0) so I don't need to keep track of where it is.
注释
You need to be logged in to post comments
Add a Comment
alsome!!!!!!!!!!!!!!!!!!!
Very realistic! but the green planet is going the wrong way
NICE!!!
kooooooooooooooooool
Fantastic scripting! It helped a lot when figuring out parabolic curves for my battle tank game! Great stuff!
Extremely instructive, thanks!