Projectile enemies are enemies that toss objects, such as arrows and fireballs, at the player if the player comes close enough. For the projectile to hit the player, there is a base from which the projectile will be generated. Depending on the distance from the player, the base will launch the projectile at a calculated angle and speed so that the projectile can reach the player. Sometimes, to increase the chance of hitting the player, more than one projectile is shot. In this example, we will shoot just one projectile, but we will make sure that we give the player a tough time.
I included the assets for the base and the rocket in the resource folder, so make sure that they are included in the project.
We will create two classes. The first one will be the shooter base, which will be responsible for checking the distance between the player and base. If the distance is less than a certain amount, then the projectile will be launched at the player. The projectile...