Unity Space Game

Introduction

In this project I will be developing a 3D space game where the player has to survive as long as possible and get as many points as possible. I am using this project to develop my skills in unity.

Setting up 

I first started with an empty scene in unity. I then imported all the files I would need for this task. I also made sure that i had everything I needed and that it was all was where it was supposed to be. I also renamed some folders so that in the future it will be easier for me to find what I need.

folders

First steps 

First of all I got the players ship and dragged it into the scene I then applied the texture to the ship and made sure it fits. I then added a rigid body and a collider to the players ship so that it would be able to interact with other things in the game. I then decided to add the jet coming out of the back of the ship. All I had to do was change it into a 2D sprite and then move it to the back of my ship and make sure that its in line with the players ship. To make my game look even better I decided to add a particle effect to the back of my ship.

ship

Movement 

Now that I had a player model I have to create a movement script so that I have the base of my game. The movement script is one of the easier scripts although it would I wanted to add other things to it to make it even better. But i worked on the movement scripts first as I thought it was more important. To make my game look more professional I added a tilt to my ship when it goes left or right. I did this because it makes my game look a bit more professional. I also had to test the ship a lot to make sure I got the right speed and tilt.

Movement

Shooting

The next thing I added was shooting for my ship. I achieved this by first making my chosen bolt usable in unity. I did this by changing it into a material by simply putting changing a setting to an empty material and then I changed its shader type in another setting. This allowed me to get rid of the black background of my bolt and make it usable in unity. I then made a prefab of it so that it could be reused for multiple shots. I then set up the speed of my bolts and the fire rate of them I spent some time on this to get it just right. when I had done this I had to make sure that the bullets wouldn’t just keep going so I made boundaries. so that if a bullet leaves that area it will be deleted.

shooting

Boundaries

When I had finished my movement I had to add in boundaries for the player so they couldn’t just fly out of the play space. This was key to making the game be playable and enjoyable. To do this I had to make a cube the same size of my play space I then had to delete its mesh so it just showed its boundaries. I then made a new code to make it so that if any of the shots leave that area they will be destroyed and put that on my boundaries. To make it so the player cannot leave that area I had to add some lines of code to my player movement script. After I had dome this the player cannot leave this area so it more like the way I want it. I also added an audio script so that when the player shoots it will make a sound. This was easy to implement as it was only a few more lines of code in my player movement script.

bound

Creating a scrolling background 

Next I added a scrolling background to my game. To do this I first had to get a quad and apply my game texture to it. After I added my texture I then had to copy my first quad and put it behind the original. I then made it a child object of the original quad. After that I created a new script and called it background. I then applied my finished script to my original quad. I then imputed the scroll speed and tile length into the open slots.

background

 

 

 

 

 

 

 

 

 

 

Leave a comment