We have several places where we want to play sounds. Let’s see what sound clips we have first.
For the purpose of today’s article I’ll focus on the laser shot.
Assuming that you have your desired sound FX file chosen and imported into your assets folder in Unity.
On our Player in the hierarchy, select the player object and in the inspector. We’ll add an Audio Source component. Make sure to uncheck “Play On Awake”.
Today I took a bit of a different tact. For this project I’m using generic assets provided by GameDevHQ and they are lovely but my inner Art director needed to stretch his legs. In addition to doing some work on my post processing volume. I also took it upon myself to :
I’m going to get a chance to add some of my own game design elements into this game very shortly and I’m very excited…
What exactly is post processing? Some like to compare it to the tools you would find in PhotoShop or other photo/video editing tools. Adding image effects and filters as well as color correction into your game to name a few.
These are very powerful tools and in the right hands they can add a beautiful and artistic flair to your game.
It’s not mandatory but it is worth seeing what effects your can derive from it. Today we’ll go about installing the Post Processing Stack and getting an overview of some of its features.
We begin by going to the…
In the past day I’ve added a rotating Asteroid that when hit will start the enemy spawn routine. I’ve also added a thruster animation to the Player ship. It looks really cool. Nothing too new in doing so. Just a lot of the same animation patterns we’ve used previously.
In the name of emersion I thought it would be cool to add a visual representation when the player takes a hit by adding a fireball with a smoke trail.
I start by dragging the first sprite image from the animation into the hierarchy. As we’ve done before I created an…
Currently when we hit an enemy with our Lasers they simply disappear. Let’s utilize our knowledge of animations and some really nice assets to make those enemies explode instead.
We start by double clicking on our enemy prefab in our project view. Then from our Animation tab we create a new Anim called “Enemy_Destroyed_anim”.
Press record and grab all our animation sprites and drag them into the animation dope sheet.
We’ve implemented our Game Over text when we’ve run out of lives but we want the player to be able to restart the game. Let’s do this!
First off we’ll create a new Text Element in the Canvas that gives the user the instructions on how to restart the game by pressing the R key.
Next it’s good practice to create a Game Manager for you game to handle these types of actions. Create an empty Object and call it Game_Manager. Next in your script folder create a corresponding new script called GameManager. You’ll notice that Unity gives it a…
Objective: Since we’ve introduced the concept of lives to our game its time to display the appropriate message when our player dies. Nothing too complicated here so let’s dig in.
Implementation: First we’ll add a new Text component that is a child of the Canvas called Game_Over_Text. Then we change the size and color to your choosing. and Importantly make the Text display GAME OVER.
Now that we have various PowerUps and Enemies spawning. It’s time to start implementing a scoring system. Once again Unity is going to Flex it’s “Swiss army knife muscles” and lets us use its built in UI system. (not to be confused with Unity’s new UI Toolkit which I will cover at a later date).
Objective: We’ll start nice and easy by getting score text to display in the top right corner of the screen and to add 10 points each time our lasers hit an alien.
Implementation: We begin by right clicking in our hierarchy view and choosing UI…
Since we plan on having more than one power-up, it’s a good time to explore the use of a switch statement instead of our If/Else statements.
The main difference is that an if/else can be used for making decisions based the parameters that it’s evaluating and a switch checks against a single variable per case (with the ability of having many cases). So clearly they have their uses in the right circumstances.
So far we’ve created a singular Powerup in the form of our Triple Shot. However we want to create a few more and maybe even …a lot more.
So the question is how do we do so modularly and efficiently? Right off the bat I know that I want to create two more Powerups. A Speed Boost as well as a Shield. Not exactly original but classic for sure.