In this section, we are going to make some changes to our game objects. We will need to add mass and elastic collisions to our collider class. Our star should be able to generate gravity and attract the player and enemy spaceship with a force that decreases based on the square of the distance. We will need to modify our collisions function to add elastic collisions between our spaceships, asteroids, and the projectiles.
Modifying the code
Changing the game.hpp file
To get physics into our game, we will need to modify several class definitions and add new #define macros. Let's start by updating our game.hpp file. The first thing we need to add is #define in order to set up a constant value for our star's mass. I want...