Now that the core of the game is nearing completion, it is time to start looking at additional frameworks to help build up the gameplay.

First on my to-do list was adding the ability to enable thrusters while a key was pressed. This was done by adding a few if() statements in the Update() function of the Player script. The code increases the player’s speed and enables the thruster graphic when it detects the LeftShift key is pressed down, and reverts the changes when the key is released.

Next, I will be making some changes to the Shield

Although it seems like something you see in every game, there is no way to quit a Unity program running in full screen by default. To fix this, I have added a function that allows a user to exit the application when pressing the Escape key.

This is done by adding a simple If statement to the GameManager script that checks for the Escape key to be pressed. When it detects the Escape key, it runs Application.Quit(), which closes the game. A more robust implementation would instead open up a menu or a confirmation box when Escape is pressed, and allow the user to quit from there.

If you want your game to be playable inside of a browser, first you need to export it from Unity in a compatible format. You can do this by going to your Build Settings and change the platform to WebGL. You may also need to address some compatibility issues before you can build. Unity will then ask you where you want to build. I created a new folder to hold this build of the game, to differentiate it from everything else.

Once the game finishes building, where you chose to save the build, you will have the Build folder, the TemplateData folder, and index.html files. These files can then be hosted on a web server to allow your game to be played upon accessing the website.

Sound effects are a huge part of bringing a game together. They give an audio cue that tells the player something has happened. Everything from collecting coins in Super Mario, to firing a gun in Call of Duty has a sound effect.

Unity makes implementing sound effects quite easy! First, you need a game object to hold the sound effect you want to play. Once you have assigned the appropriate sound to it, you can then using scripting to tell your game when to play the sound effect. Using the AudioSource Class, you can create a variable to use AudioSource.Play() to play your sound effect at specific times.

In my game, I have set up sound effects for when a laser is fired, something explodes, and when a powerup is collected.

Sound is essential in bringing your game to life. The right sounds can tie everything together to set a specific scene or mood. I still listen to soundtracks from games I haven’t played in years, because they evoke such strong emotions.

Once you have the music for your game, implementing it into a scene is pretty easy. First, create a GameObject to hold your sound, apply the Audio Source component to hold it, and apply the sound you want to play from your Project pane. Now, as long as this component is enabled and in the scene, the audio will continue to play. Currently, my project has BGM enabled for the main gameplay scene, but when I go back to the main menu, the music stops playing because it is not set up for that scene.

When building a game in Unity, you have access to a whole suite of Post-processing effects that you can use to change the appearance of your game.

Here are a few I have enjoyed playing with!

Bloom

Bloom is an effect that enhances the brightness of everything in your scene…

Now that the enemies are nice and explodey, Its time to add some battle damage to the player. This will give the player a visual representation when they have taken damage. To accomplish this, I added two new game objects under the Player in the hierarchy; Left and Right…

Ken Sullivan

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