Presenting Clayton’s Space Shooter

My Space Shooter version is not that different to the tutorial’s version and any changes was mainly aesthetic. I did want to give it my own touch and after numerous hours of editing, changing, unchanging, changing, trying, adding, changing, editing I finally decided on the final version. This is some of the changes I incorporated.

Changing the Background

The first and easiest change was changing the backdrop. I wanted something a bit brighter as well as a background that would give the player a sense of how big, or how vast space is. I also wanted to give the player a sense of flying towards something, or past giant suns and planets.I created the background by combining a number of different photographs downloaded from free sources online and then merged them into one image. I used Microsoft Word to import the pictures and then simply changed the transparency colour on each image. I also scaled each image, rotated and moved into position. I then used the snipping tool to take a screen shot and saved that in the Space Shooter Imported by Me assets folder.

I then applied the new image to the backdrop by simply dragging it onto the background in the hierarchy. I had to change the scale so that the background did not look compressed or stretched.
backgroundgameview.PNGNow I wanted the player to imagine they were travelling past a near bright star or stars so I thought it would be cool if the lighting reflected the lighting of such celestial bodies.
I shifted the whole background in the scene view so that the sun like object was at the top of the screen. I changed the colours of the Main Light to black as the star’s light is coming from below the ship, so it created a shadow effect to the top right-wing of the ship.
I then changed the Fill Light to a more orange colour to reflect the stars actual light and colour.
Finally I changed the Rim Light to more of a blue colour to also help with creating shadows when the ship tilts and moves.
I wanted the player to feel like they were travelling through space so in order to achieve this effect, I had to create a particle system to replicate a star field moving or scrolling in the background. Fortunately I did not have to create a system from scratch but one existed in the asset store which I tweaked some of the values in the inspector.
I left the Prewarm box checked as I wanted to see a complete cycle of stars viewed immediately instead of starting at the top and scrolling down when the game starts. I only changed the start sizes and the start colours and left all other settings the same as they suited my purpose.
BGScrollerscriptI now wanted to make my background to be scrolling. I duplicated the background and then made it a child of the original background. I then added the following script called BGScrolling. Once the script was finished and added to Unity I adjusted the scroll speed, making it a negative number as I wanted the background to scroll down. I also set how many tiles does the background move forward in the Z axis direction.

Adding Extra Hazards

changingasteroidmeshTo create the asteroids I used the assets downloaded from the Asset store. In much the same way as I created the first hazard asteroid, I placed the prefab in the hierarchy and then duplicated it twice. I then renamed each asteroid so that I had asteroid, asteroid_1 and asteroid_2. In the inspector of each asteroid I went to the Mesh Renderer component and pressing the little icon. Select the desired mesh from the displayed options. I then dragged the two new asteroids created into the Prefabs folder to make them prefabs. I then had to go and change the Game Controller script to incorporate the new hazards and how they will appear or spawn in the game. The first thing was to change the variable hazard to hazards and make it an array so that the game could select an asteroid at random.
Then in the Spawn Waves function I added the line so that the hazards array was called and then a random asteroid was chosen  from the array and spawned.
changing_hazards_2_array2 In the Game Controllers inspector I had to drag the asteroid prefabs into the Hazards section in the Game Controller component.
changing_hazards_2_array_inspectorviewI also changed around the score values for each hazard as well as their speed. I gave the slowest moving hazard the lowest point score and the fastest moving hazard the highest point score. When I ran the game, I was happy with how the asteroids moved as well as their point values. It made the game a bit more interesting and challenging but still as not enough.

Adding Enemy Ship


Another element that would make the game more interesting is by adding an enemy spaceship. I downloaded the asset for the Asset store to begin with.
I then created an empty game object in the hierarchy and renamed it Enemy Ship. I dragged the vehicle_enemyShip prefab onto the Enemy Ship object making it a child, I did the same with the engines_enemy. Once done and the Enemy Ship parent is selected I added a rigid body component and made sure to un-check ‘Use Gravity’ and checked ‘Is Trigger’. Lastly I added a sphere collider and adjusted its values so that it covered the enemy ship without being too large or too small.
To make the enemy ship start to function and operate I added the Destroy By Contact script which then gave me the options…
I then created and added a new script called Weapon Controller.
Going back to Unity after saving the script.
weaponcontrollerunityview.PNGI also added the Mover script to the Enemy Ship parent object and adjusted the speed. Now the enemy ship moves forwards and fires at me but that’s boring so I want to make the enemy ship maneuver as well. To do this I added a new script called Evasive Maneuver.
evasivemaneuversscript.PNGOnce all the values are set in the inspector in the Evasive Maneuver script the enemy spawns and operates the way I want them to. I had to remember to drag the Enemy ship into the Hazards section of the Game Controller script component.

Tripling My Fire Power

Now the final change….sorry I couldn’t resist. I am a designer so I will change things and not always, almost never be totally happy and satisfied with what I have designed.
I wanted to add some extra fire power to the players ship. I did this by duplicating the player ships shot spawns and then change the relevant scripts. I won’t go into too much details as this post escalated quite quickly, but other than having to use three different fire buttons to fire the three laser bolts, I had no real issue creating and implementing the extra fire power. I would like to fire all three laser bolts with one fire button but I could not get it to function properly no matter what I tried. So for the moment, the left Shift, left ctrl and the left Alt control the firing. I must find out more about how to make it one button to fire all lasers. Methinks, a change in the waiting time between shots might have something to do with it, but am probably way outta the ball park there.

Well that’s it for now. Other than a few issues, I am happy with the final result. My changes seem to project what I wanted the player to feel and see as they play the game. I have published it to itchio for anyone to have a go.

What did I learn from this exercise?

I learnt a lot from building and designing this Space Shooter. Some of the knowledge and skills I gained through this exercise are as follows:
ο   I learnt a lot more about the lighting of the game and how it works. I was not aware of the depth of lighting that one could achieve in a game. The many levels are ideal for creating just that right amount of light to set the mood.
ο   I learnt how to set up and create an array of objects that could be randomly picked from. Having to not only write a script but also create objects and attach them to the objects in the inspector was complicated and confusing before. Now I have a clearer understanding of what needs to be done to make an object function the way I want it to.
ο   I learnt a lot about mathf and clamping functions to restrict values between a minimum and a maximum and how it is used to clamp an object within set boundaries or limits.
ο   I learnt a lot more about scripting. I still have a long way to go as its only my second real game creation, but it is encouraging to know that I can work my way around a script and sort out a lot more issues and problems before having to ask for help. I also know the exact places to go for help with creating a script through the Unity website as well as other forums.

Clayton’s Space Shooter on itchio

Okay that’s definitely it for this post, it turned into a massive one in the end, apologies to my awesome tutor for enduring. Thank you for your company, patience and interest, I hope you gained something from this post. Until next time…

God’s blessings in abundance upon you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s