I did a basic gravity simulator a while ago but lost the .cap file
i remember the equation though
multiply the two masses, and then divide by the distance between the two.
you can then multiply that whole thing by a constant to fine tune how strong you want it.
i was using physics so it was
apply that force to both the body's towards each other. It worked perfectly
edit: i forgot, the distance between the bodies was squared