Galaxy Shooter — Phase II: Core Programming
Day 48 — Aspiring Game Creator
2D Game Dev: Galaxy Shooter
Objective: Enemies can destroy Power-Ups & Pick-Ups
Again, making use of the enemy’s Field-Of-View scan, once a power-up, pick-up or collectable crosses the enemy’s FOV, a laser beam shoots at the object, destroying it before the player can pick it up.
As the enemy zooms down thru space, the FOV cone will trigger on the PowerUp tag and call back into the Enemy’s parent method: DestroyPowerUp
The referenced power-up game object is passed into the Destroy method, which starts a coroutine to draw the laser beam, disable the laser beam and destroy and instantiate the explosion.