What equations are needed to describe how two bodies interact? For a small project I am thinking about making a 2D game in which there are two planets, each of a random size, and when you run the game it will show how those planets interact due to gravity. I'm not that experienced with physics, so my question is: What equations are needed to accomplish this? 
Note: I am not asking how to represent this in a game, I'm asking what formulas describe it in real life. 
 A: For a simple simulation you just need two equations that can be combined into one:
Newton's law of universal gravitation:
$$F=\frac{G\,m_1\,m_2}{r^2}$$
And Newton's second law:
$$F=m\,a$$
So the final combined equation would be:
$$a_1=\frac{G\,m_2}{r^2}$$
Or if your planets have positions $p_1$ and $p_2$ the vector equation would be:
$$m_1\frac{d^2p_1}{dt^2}=-m_2\frac{d^2p_1}{dt^2}=G\,m_1\,m_2\,\frac{p_2-p_1}{|p_2-p_1|^3}$$
Depending on how you do your integration it's likely that your orbits will be unstable. If you'd like your orbits to be stable, then you should use orbital equations that are already integrated and just follow those equations.
One advantage of doing the integration numerically is then you can include more bodies:
$$\frac{d^2p_i}{dt^2}=G\sum_{j\neq i}m_j\,\frac{p_j-p_i}{|p_j-p_i|^3}$$
To use this acceleration one possibly way to integrate would be to use the Leapfrog Method Here rather than keeping track of velocity you keep track of the last two positions:
$$p_{next}=2 p_{current}-p_{prev}+\Delta t^2\,\frac{d^2p}{dt^2}$$
So putting it all together in component form:
$$f=\frac{\Delta t^2\,G}{\left((p_{1x}-p_{2x})^2+(p_{1y}-p_{2y})^2+(p_{1z}-p_{2z})^2\right)^\frac32}$$
$$p_{1xNew}=2p_{1x}-p_{1xPrev}+f\,m_2(p_{2x}-p_{1x})$$
$$p_{2xNew}=2p_{2x}-p_{2xPrev}+f\,m_1(p_{1x}-p_{2x})$$
$$p_{1yNew}=2p_{1y}-p_{1yPrev}+f\,m_2(p_{2y}-p_{1y})$$
$$p_{2yNew}=2p_{2y}-p_{2yPrev}+f\,m_1(p_{1y}-p_{2y})$$
$$p_{1zNew}=2p_{1z}-p_{1zPrev}+f\,m_2(p_{2z}-p_{1z})$$
$$p_{2zNew}=2p_{2z}-p_{2zPrev}+f\,m_1(p_{1z}-p_{2z})$$
If you just want to do 2d you can ignore all the z coordinates.
