Galaxy Shooter — Phase II: Core Programming
Day 47 — Aspiring Game Creator
2D Game Dev: Galaxy Shooter
Objective: Implement wave system.
From very early on Galaxy Shooter has had a basic Wave System. It’s actually a very important — if not the most important aspect of this game — stay tuned till the end to understand why!
Maybe the most complex of all the systems/classes implement so far, the wave system makes use of a Wave Class. At the onset it only contains four variables, but will grow along with the game.
Each Wave will have a title (Wave Chapter), enemy prefab, enemy count and delay between enemy spawns.
Using the System Serializable attribute will allow the Wave class to be edited in Unity. Below 3 of 5 Waves are defined, currently each making use of the same enemy prefab, but eventually arrays will be used for tracking multiple enemy types and their count.
Until last phase of the game is implemented, a basic Time Between Waves variable will be used to wait between announcing & starting waves.
The Time Between Waves is passed to the UI Manager which shows the 3, 2, 1, countdown, the Wave Chapter name and the Incoming message.
The enemies are spawned via a coroutine:
Once all enemies for the current wave are spawned, the system waits for the player to destroy all enemies.
As each enemy is destroyed, the enemy counter is adjusted. Once all enemies are destroyed, the wave count is iterated, a new countdown begins and again, enemies spawned.
Sandwiched within enemy spawning is a rudimentary Power-Up/Pick-Up spawning system.
The Power-Up spawning system will eventually be dropped and specific power-ups and pick-ups will become part of the Wave System, those power-ups & pick-ups integral the specific waves.