Project 1: Space Shooter
From prototype to looking like an actual game
Adding assets to spice up the look
Now that I have some of the core mechanics of the game ready, it’s time to add some fancier graphics. Before I can begin that, I have to change the Scene view from 3D to 2D. This will help me to see how the assets interact with one another, when the view shows the xy-plane.
The assets I am using are provided by GameDevHQ in their Filebase asset pack. So all I have to do is to download the latest Filebase, and once that is done, just drop the downloaded file into the Project view. That is how simple it is to add new assets into Unity.
Of course, with Filebase I do have to locate and download the actual assets for my 2D space shooter, but that is also easy. Just open up Filebase, search for tutorials, and pick the 2D space shooter assets, download them and it’s done.
The assets provided in this package include a background, which I can just drag and drop to Hierarchy view to have it in my game. Then the player’s spaceship, yet again, just drag and drop, and same to the enemy ships and the laser.
When working in 2D in Unity, I have to make sure that all my objects are on the right plane. That is, the background is on the lowest plane and the other objects are on the next plane up. This way my objects are always visible, although it could be fun to do some hiding action…
Unfortunately, with these sprites I cannot use the 3D versions of some of the object components nor the methods in the scripts. Though, thanks to Unity their 2D counterparts are easy to find and add. After all, they are almost the same, just add 2D at the end. Like Rigidbody 2D, or OnTriggerEnter2D, quite simple indeed.
Once I changed all these components and methods to the 2D versions, with basically the same settings. That is, checking the Is Trigger box and removing the gravity, and as a new feature that the Sorting Layer is correct, it’s time to test the game.