Every time I start a new project, I spend a fair amount of time reflecting on pain points from previous projects, what I enjoyed working with, things I would still like to try, current standards and patterns, and how my fellow engineers might react to something I write. One of the big problems every project faces: how to access what you need, from where you need it. I’ve done a bit of experimenting and decided to share something I think is worth further exploration.
We’ve come a long ways, but there is still one major thing we’re missing. We don’t have a real game because there is no way to win or lose! In this lesson, we will learn about Unity events, and how to compose them together so that we can have victory and loss conditions.
While you “could” create all of your game boards by manually placing row after row of blocks, manually editing each as needed, there is an easier way. Well, at least it’s easy once you are comfortable writing code. In this lesson we will continue to practice and learn new tricks so that the computer will do the “hard” work on our behalf.
Now that we can hit a ball with a paddle, we need something to aim for. Breakout style games have an array of blocks along the top of the board for the user to destroy. We will create some blocks, then create something called a “Prefab” that makes it easier to apply changes to multiple instances.
Now that we’ve got some experience scripting, we can get slightly more advanced with the creation of our Paddle. In this lesson we will create the bar which moves back and forth across the screen based on user input.
Unity has already enabled us to easily accomplish a ton of milestones, such as rendering sprites on screen, and making objects move and collide with each other. At some point, you will always find that some of the features you want to use require the use of a script. In this lesson we will create our first script and show how it is used like a custom Component. We will use the script to control some of the behavior of our Ball.
A lot of game development is occupied by time spent in the Unity Editor. There are even whole jobs specifically for Level Design. This is both for function and visual appeal. In this lesson we will spend some time preparing our scene to look more like the finished game.
As a game engine, Unity provides a lot of functionality right out of the box. You could make some really fun physics based games and not need to have a math degree to do it! In fact, in this lesson we will start creating game objects that react to physics, with no programming required.
When just starting out in game development, it is very common to want to jump right in to making your dream game. If you love your ideas, I would suggest waiting, at least for a bit. To do your game justice, first develop some skills. You can build these skills through repeated simple successes that lead to incrementally more challenging and rewarding goals. With this approach in mind, this project is an ideal starting point for beginners. We will cover a large variety of game topics like physics, handling user input, and even some scripting.
Handling User Input
Most projects you will create in Unity are probably intended to be interactive. They should be able to respond to mouse clicks and drags, keyboard, touch, or other forms of user input. This tutorial will cover a variety of options by which you can manage these types of events.