After we add the recoil to our spaceship's cannon, I would also like to add a gravitational effect on the spaceships in our game that will draw the ships toward the star when they are within a certain distance of that star. The gravitational force decreases with the square of the distance between the two objects. That is convenient because it means that we can calculate the gravitational effect with the MagSQ function, which runs quite a bit faster than the Magnitude function. I have chosen not to add a gravitational effect on the projectiles and asteroids out of personal preference. It will not be hard to add that effect if you choose to do so.





















































