George Asiedu

Another feature to add to the player is lives to the shield through visually showing it by colour so it looks like the shield takes damage. We start by duplicating the shield within the hierarchy:

We then make these shields visually different within the inspector by changing colour or size, whatever suits the look you are going for. I went for colour.

To add a little more speed to the game, I have added a little boost to the player by adding an after burner. This will be done by re using the thruster animation and making it bigger when the Left shift key is pressed.

Afterburner on / off

This is controlled in the hierarchy with another asset as a child to the player like so:

now that we have a game with a build , we will want to be able to quit it. this is done through “Application.Quit” the code can look like this:

I added the debug log in there so you can see it is recognised within the console as you can not quit while testing within unity.

Just like before within building settings we want to select “WebGL” and we want to “switch platform” to rebuild our project so that it can be built

Build Settings

Once this is done the Unity symbol will be next to the appropriate platform. We then want to resolve the warning related to the colour spacing within the build. You can find this within the player settings > Player > Other Settings Colour Space, this needs to be chnaged to Gamma for WebGL.

Now that all the main elements of the game are finished we can turn our game into executable file to test. This is done through the build settings under file.

Build settings

Within the player settings we can adjust whether it is windowed or full screen. Under play settings we can also adjust the type of full screen mode you would like. Once all settings are set you can run the exe. very simple and you can see all the platform you are able to use. Just have to have that module installed.

To get sound effects within your project you will have to add a new component ”Audio Source”

Audio Source Component

now having this on our player we can begin to code it within the script. we can start by storing the sound in a variable.

Lets start by adding an empty object and naming it Audio Manger. Then adding a child to it called background.

to the background we will add a component called “Audio Source” this communicates with the Main cameras component called “Audio Listener”