well the algorithm would be complicated, but i guess it is based on magnetic attraction, since thats what happens on the sun...

for the glow, just use a glow sprite, and put it in the sun axis, and facing the camera, with the function

ent_create("glow.png", sun.x, NULL);

your.pan=camera.pan
your.tilt=-camera.tilt

and so on
OF course there is better and more quality aproaches using Post processing glow etc...