Launch some planets by clicking and dragging in the black area. Then watch gravity in action! Additional Controls (all in the blue panel on the right): - S/M/L/XL buttons change the next planet size (keys 1-4 also work). - 'Sun' tickbox adds/removes a large sun in the center. - 'Trails' tickbox' shows/hides trails behind planets. - 'Stars/Grid/Blank' picker sets the background. - 'Play/Pause' button pauses and resumes the simulation. - 'Reset' button clears all the planets. - 'Zoom' slider changes the zoom level. - 'Presets' opens a menu where you can experiment with some pre-made solar systems.
Thanks Isaac Newton for the formula. Thanks RT for the trails idea. Sun sprite is from https://www.joshmorony.com/how-to-create-a-day-night-cycle-in-phaser/sun/. Planet sprites are from https://opengameart.org/content/17-planet-sprites. Explosion sprite is from https://scratch.mit.edu/projects/11833440/. Thanks all!