2D Shooter: A Display for Waves

Objective: Create a display that shows the start and number of the wave.

Create a new UI text object in the Canvas object, and name is Wave_Display. Change the text to how you want it to look in game, and then create a new animation. For mine I changed the opacity to 0 in the first keyframe, raised it to 100 and then back to zero according to how I wanted it timed.

You can change the opacity of an object from the color swatch wheel.

Now let’s go to the UiManager script. We’ll want to create a variable to attach the object to.

Now let’s make a method that will update the wave number and start a coroutine to deactivate the object when the animation is over.

You can go to the spawn manager and tweak the wait time that delays enemy spawning until it times out better. For now, let’s go to the script for the Asteroid. We don’t want the display to show until after its destroyed.

Create a variable for the UIManager and get the script component.

Now let’s call the DisplayWaveNumber where the asteroid detects collision with the laser. We’ll want to pass on a variable representing the number 1, as shooting the asteroid will begin the first wave.

And now the display will work with what we have right now. We’ll be working on a more fleshed out wave system in the next article.

--

--

--

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!

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

Recommended from Medium

What Are The Benefits Of Website Testing On The Cloud?

What Is the Null Object Design Pattern?

New in April, May, and June 2018

Android Hook — ASIS CTF Final 2018 — Gunshops Question Walkthrough

Combination — Order doesn’t Matter!

A more productive Layout in Unity.

Notes from 20–27/7

NameCheap and Firebase Hosting

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
Sabrina Windsor

Sabrina Windsor

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!

More from Medium

What’s new in PVS-Studio in 2021?

How hard is “Game DevOps” in Unity?

Flip Anything Moving— Version 2

Journal 131 — Unity App Development, AWS Setup Part 3