Hey link I am working on a very similar thing myself... I have used three objects though... one "planet" object, with a lower mas "moon" object, then even lower mass "comet" objects.
When two comets collide, they make a moon, and when the moons collide with the planet, the planet gains mass and the moons are destroyed.
I will make it so the "player" can shoot the objects;
shoot a comet, and it is destroyed
shoot a moon and it breaks into 2 comet objects
shoot a planet it will lose mass equal to two moon objecs, and create two moon objects
if the planet is shot enough, it will be destroyed.
comets at the moment are only attracted to the moon objects, and the moon objects are currently only attracted to the planet object, but the effect is rather convincing.
I was basically trying to get a psudeo version of the video that deadeye posted.
Instead of using xy measurements based on distance, the force applied is equal to the DISTANCE FORMULA of the objects, so if they are far away they will to to move back together more quickly... this is the opposite of what would happen in a real world experiment, but for applied mechanics in a game situation, it seems to work quite well.
I will keep playing with it before I upload... the way your example works is probably way better than mine, so I may work with your example and include the merging and seperation of objects based on a player shooting at them.
~Sol