For a planet of mass m, at a distance r from the ship, the ship will experience
an acceleration:
a = k m / r^2,
where k is some constant that depends on the units you're using. The acceleration will
be directed toward the planet. It might be convenient to break down the acceleration
into its components along the x and y axes (assuming you're working in 2 dimensions).
If the planet is at an angle theta in the x-y plane, relative to the ship,
ax = a cos(theta)
ay = a sin(theta)
For multiple planets, you can just add the accelerations component-wise.
If the ship has an initial velocity vx at time t, then the velocity at
the next time step t + delta_t would be:
vx + ax * delta_t
If this ship is at initial position px at time t, then the position
at t + delta_t would be:
px + vx delta_t + ax delta_t^2 / 2
See: Equations of motion