Refactored 2-body simulator (elliptical orbits)

(remixed from 2-body simulator (elliptical orbits), by cindyli) by erubin1952
See Code Download Embed
I extracted a "fall" block to make the original code much DRYer.  No more duplicated code for each sprite.  I also made mass and velocity local to each sprite.
This make it possible to have as many sprites as you want, each gravitaionally attracted to all the others.
I'm going to play with that next.  Maybe even simulate the whole solar system.

Created December 30, 2020

Last updated December 6, 2022

Published December 31, 2020