Galaxy Shooter 2D - Beginning #1
This is quite funny. The first project I did to learn how to code was also a 2D Space Shooter. It brings me fun memories of me struggling to use Unity and C#.
Today, I am starting a new Unity project, following the 2D Course from the GameDevHQ Unity Program.
As a Game Designer that has already worked on multiple Unity projects and released 3 games to the public, it took me no time to rush a bit through it. It’s your basic galaxy shooter that counts with the typical elements you would see in one of those kind of games.
Don’t get me wrong, this course is fantastic for beginners; it offers cool assets, everything is explained in detail, and challenges you to code functionality on your own (nobody holds your hand in a professional career, so, get used to it).
If I want to become a proper Software Engineer, and most importantly, a professional Unity developer, I must go back to the beginning, and start climbing again. It’s a cycle I don’t mind repeating.
Recognising the Core of the game
Starting a new project might be hard. Not that hard when you’re doing a course, and you have a personal instructor telling you what to do at every moment. But, for those making games alone, design first your core features of your game, don’t get distracted in other functionality that you’ll do eventually, and start prototyping.
The main features defined by the course are:
- Player Ship: We obviously need a ship that moves and shoots lasers at a steady pace when the player presses their respective inputs. We also want to create bounds, so the ship doesn’t leave the screen space, and create the concept of “Health”, so the player can get damaged and killed.
- Enemy Ship: For now, we just want it to move downwards, scroll back up to the top of the screen when it leaves the screen, and randomize the X position to add unpredictability. Besides, if it collides with the Player ship, we’ll destroy the ship and damage the Player.
- Laser: A projectile that damages both the Player and the Enemies. Quite simple.
- Spawner Manager: As soon as we start, we have nothing else to fight except the enemies that were already in the scene. A Manager tasked with spawning entities at a constant rate, and stopping when the player is dead will solve that problem.
Once we have implemented these core features, we can start building on top of that, adding new stuff every time, or modifying things like the orientation of our game.
From Prototype to Production
You have tested your game, the core mechanics work, and the game is fun. Congratulations, you entered the Production Phase, and now you can start adding even more content.
Now, you have to focus on extra content (new mechanics, scenes, enemies…), create assets such as models, sprites, or sounds, improve the visuals of your game, and add UI to inform the player about the game status…
Luckily, the course offers you neat assets which I used to move the game from a 3D game to a 2D game.
The next step in the course checklist is to add power-ups! This time, the ship will have its first temporary upgrade which will let the player shoot three lasers at once!
But, keep in mind that they expect us to create even more power-ups. We can’t create a new script for every power-up in our game. Because every power-up will behave the same between them (moving, bounds…), we can reuse this script, and then, modify what we want (speed, power-up type…). We’ll select the power-up type using enums, and we’ll trigger the power-up ability in the Ship script.
Do not be fooled by this article. Despite I made it appear easy, it takes time to reach to this level of knowledge to do this in record time. For you Unity newbies, take your time, make sure you understand what you’re doing, and be persistent. Treat coding like little challenges you must tackle, and have fun on your gamedev journey. That’s all that matters.
It’s time for me to wrap up this article, and continue making progress. Remember to follow me for more articles on Unity, and my journey to become an Expert using Unity.