Phase II: Enemy Destroy Pickups

Objective: The objective today is pretty straightforward. We want a new enemy type that will detect powerups in front of them and will fire at and destroy them to keep the player from getting them.

This objective builds very nicely with some of the previous ones since it involves detecting an object in front of the enemy and performing an action when it is detected.

First, I’m going to create a new enemy, and in its script, it will inherit from the BaseEnemy class. I’m going to name it the EnemyXPowerup and will use the sprite below.