You are right. =)
You can get the distance between the two with distance(Player.X,Player.Y,Sun.X,Sun.Y)
If you want to make it more realistic and make the effect of distance stronger you can square that value.
You could also give the planet/star a mass variable and use that instead of directly specifying a force. Might make things easier if you have many planets/star and use families later.
http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation
EDIT: Looks like spongehammer beat me to it! =D