Galaxy Shooter — Phase II: Core Programming

Rob George
May 15, 2021

Day 48 — Aspiring Game Creator

2D Game Dev: Galaxy Shooter

Enemies now have the ability to detect & destroy power-ups

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.