Setting up for Waves and Breaks

It’s time to start thinking about how our game will differentiate between levels or waves of Enemies. Let’s start by making an asteroid object for the player to shoot when they are ready to start. This will give the player a chance to get used to the controls or to catch a breathe after a defeat. This can also offer us a space to show additional information to the Player, such as identifying power ups or enemies (Think Pac-Man).

We can get the asteroid from the wonderful Filebase.

This pack has 6 different Asteroid models that share two Material sets. We can use all six models though our game without adding further size to the final game.

Now, let’s take a look at the script that is giving us the effect above.

We have some basic Variables setup that are exposed for the designers. When we start the script, there is a check to see if the designer has changed any of rotation settings. If the settings have not been set, we set them to random settings. This let the designer or the script to give the Asteroid rotation motion. We currently use the Update() to take care of the rotation.

To handle the Laser, we mimic the Enemy’s OnTriggerEnter(). It will be expanded later, but for now, we Pool the Laser that hit the Asteroid, Spawn the Explosion and disable the Asteroid’s Collider (so that extra lasers don’t hit it) before setting it to be destroy in half a second. Then we check to see if this one was marked as an Asteroid to start the Spawning, then we can start Spawning if it is.

In the SpawnManager, we make a bit of a minor change to make prevent the Spawning from doubling up on us be accident. We do this by adding a check around our StartCoRoutines and set the _spawning bool to true, so that these can only be started when the Bool is false.




A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to put that GPU to good use with Python

[APP] AppStarter v4.0 | AppDrawer and Kodi / SPMC Updater for Amazon FireTV

Configuring HSTS In Apache

How to test your Unity Game on multiple mobile platforms and deploy automatically to the app store.

Installing RustUp on MacOSX and Fish Shell

Automate any USSD Service on Android

Programming with Python

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Thomas Kesler

Thomas Kesler

A Unity Developer with a fondness for Fantasy games and the challenge of pushing boundaries.

More from Medium

Creating A Ledge Grab in Unity — Part 3: Snap player in the ledge position.

Pokemon in Unity: Using Scriptable Objects

Animator Controller as a Finite State Machine in Unity

Animation scripting in Unity Engine