Making enemies
In real life, making enemies is never a good idea. But in the context of video game development, it is often a great way to challenge the player and put them against some opposition.
The enemy that we will be creating is fairly simple and straightforward. But we will still learn a lot along the way – for example, how to let enemies navigate toward the player to attack them.
Like I said, we’ll keep the enemy simple. We’ll be making an enemy that spawns at a random time in a random spot of the arena and starts charging toward the player. From the moment the enemy touches the player, we’ll deduct one health point from the player’s life and remove the enemy from the game. This way, the player has some adversaries but should not get overwhelmed by a horde of enemies.
In the following section, Shooting projectiles, we’ll develop a way for the player to defend themselves. But for now, we’ll solely focus on the enemy...