Hi! The next block of code updates the positions (as you noticed):
self.last_pos = self.pos
for p in planets:
p_pos = p.get_pos()
mass = p.get_mass()
d = (self.pos[0] - p_pos[0])**2 + (self.pos[1] - p_pos[1])**2
a = (Settings.g * mass * (self.pos[0] - p_pos[0]) / (d * math.sqrt(d)), Settings.g * mass * (self.pos[1] - p_pos[1]) / (d * math.sqrt(d)))
self.v = (self.v[0] - a[0], self.v[1] - a[1])
self.pos = (self.pos[0] + self.v[0], self.pos[1] + self.v[1])
Each step, the velocity of the particles is updated with the acceleration due to gravitational force. This can be split into updates for all separate planets. For each planet, the acceleration is g*mass/(distance^2) in the direction of the planet (g can be used for tuning you system). This is where the additional 1/distance factor comes in, as the total acceleration is devided proportionally over the two elements of this vector (this is the (self.pos - p.pos)/sqrt(d) factor (note that d is distance^2)).
With this acceleration, the velocity is updated. With the updated velocity, the position is updated.
If you want a timebased method, you can put an extra factor before the position update to make the particle travel a bit longer or shorter into that direction. (That is, if you're keeping track of the framerate, you can adjust the distance the particles go each frame accordingly.) The reason that it works fairly well with slingshot is that we have limited the framerate to only 30. The framerate doesn't drop below 30 too easily (well, it still can...).
EDIT: put the same factor before the velocity update as well.
I hope it's clear. If not, I can make some graphics to illustrate where all factors come from.
Glad you like the game!
Bart