Unity 2D UFO game

 Introduction

In this project I will be making a 2D UFO game which will involve a controllable player, enemies, traps and a score system. I aim to have all the features in my game and more complex ones in the future.

Setting up

To start my game I first created folders for all of the things I will be using such as assets, prefabs and scripts. When I had done this I then imported all of my game objects such as the UFO and background tiles. I then put my UFO and background tiles in the assets folder that I made earlier. I also made a copy of my background pieces and put them in my prefabs folder. The prefab folder is just a normal folder but whenever I edit any object in the folder it does it to all copies of that object. This is very useful because it saves me time as it would take a long time to edit my whole background.

folders

 

I then had to do the same thing with my hierarchy but instead of a folder I created an empty game object and put what I needed in it. The hierarchy is very important as that is where you edit objects in your scene. I had to make sure everything was where i wanted it to be to increase efficiency later on. For this project I will use this plenty of times for setting up of objects in the scene.

list

Play space 

I first set up the play space using already made assets. I then imported them in to my game so I could make my player and background of my game. I first imported my player and put it into my scene. I then began work on a small background of my game so that it was ready for basic testing.

1

Movement 

I then began work on player movement so my game could actually be played and tested. I first created and coded my script to allow my player to move. I had to do a few tests as I wanted to get the speed just right. I also experimented with the floaty controller but I found it not very good for testing the movement. This was relatively easy to set up and make.

Movement

Health and score system 

I then wanted to set up a health and score system within my game so that I was ready for real testing. To do this I only had to add some new scripts with a couple of lines of code and add to my movement script a bit to create this system. I also had to set it up so that it was displayed in the corner of the screen but that was also very easy to do. When I did finally set this up I ran into a problem I had no way to test this feature so I found that i could test the score by adding gold nuggets by importing them and adding a line of code.

2

Enemy 

I then began work on the enemy so I could have a way to see if my health system would work. To get the enemy set up was relatively easy it only took a few lines of code in my enemy script and I had to tag my player as the player. In the code I had a few issues so I decided to have my game print hit so I could test the collisions. Overall it was easy enough to set the enemy up and get it working.

enemy

Evaluation 

Overall I think this project went well as I had a fully functioning game. However, I would have liked to add more complex features to my game but I did not have time. In this project I think that I learned a lot about unity that would help me in future projects.

 

 

 

 

 

 

 

 

 

 

 

Leave a comment