-
In this beginner assignment we're going to make a
-
very simple but playable 2D game
-
to use many of the basic concepts
-
from the beginner tutorial modules.
-
We'll be making a 2D UFO game
-
where we'll be collecting gold nuggets.
-
We'll see how to create new game objects,
-
add components to these game objects,
-
set the values on their properties,
-
and position these game objects in the scene
-
to create a game.
-
In our game the player will control
-
a UFO flying around the game board in a
-
top-down 2D view.
-
We'll move the UFO using physics and forces.
-
We'll look at the input from the player
-
through the keyboard and we'll use those inputs
-
to apply forces to the UFO,
-
making it move in our scene.
-
We'll see how to detect contact between
-
the UFO and the pickup game objects
-
and use these events to collect
-
the pickup game objects.
-
When we've done we'll have made a simple
-
UFO game where the player controls the
-
UFO with the keyboard, picks up and counts
-
special collectable objects,
-
displays the current count,
-
and ends the game when all of the
-
game objects have been picked up.
-
To complete this project we'll use custom
-
created 2D art assets
-
which can be downloaded from the
-
Unity Asset Store.
-
Let's begin by creating a new project.
-
First open the Unity editor
-
if you haven't done that already.
-
You can create a new project by
-
choosing File - New Project.
-
This will bring us to the home screen.
-
On the home screen you can create a
-
new project either by hitting the
-
blue Create New Project button
-
in the centre of the window,
-
or by clicking the New button
-
at the top of the window.
-
The first thing that we need to do is
-
to give our project a name,
-
I'm going to call the project UFO Game.
-
The next thing we need to do is set the
-
destination, or path, to our new project.
-
I'm going to put this new project on my desktop.
-
You'll see we have a choice
-
to set the project preferences
-
to either 3D or 2D mode.
-
Since we're working in 2D
-
I'm going to click 2D.
-
This will set the preferences for the Unity editor
-
to useful defaults for creating 2D game.s
-
For more information on working in 2D,
-
please see the information linked below.
-
Now click the Create Project button
-
to create our new project.
-
Unity will create a new empty scene
-
for us to work in.
-
The first thing we'll need to do is to download
-
and import our art assets
-
from the Unity Asset Store.
-
To access the Asset Store choose
-
Window - Asset Store.
-
Or use the keyboard shortcut
-
command + 9 on mac,
-
or control + 9 on windows.
-
The Asset Store is a service that
-
Unity Technologies provides
-
where creators can both buy and sell
-
assets to make games.
-
These include art, music, scripts, effects,
-
all the way up to complete games and projects.
-
Unity also publishes content
-
to the Asset Store, including teaching
-
projects like this one to help
-
you learn how to make games.
-
By default the Asset Store is
-
opened as a docked tab.
-
Let's undock the tab so that we can
-
expand the window.
-
In the upper-right corner of
-
the expanded Asset Store window
-
we'll see a listing of asset categories.
-
At the bottom we should find
-
Unity Essentials.
-
Expand this category and we'll find
-
a subcategory called Sample Projects.
-
Within Sample Projects we'll find
-
an item called 2D UFO tutorial.
-
Click on the item title to open it.
-
Once the page loads we'll see a
-
download button in the upper-left corner.
-
Click on the Download button to begin
-
downloading the assets.
-
The Download button will be replaced
-
by the percentage of the download completed
-
once we click on it.
-
Once the download is complete we'll see
-
a dialogue labelled Importing Complete Project.
-
This warns us that importing a
-
complete project will overwrite
-
our current project settings.
-
In this case, because we've just created a
-
new project this is fine.
-
Click the Import button to continue.
-
Next we'll be given a choice
-
of which assets we would like to
-
import in to our project.
-
The default is All, which is what we want,
-
so go ahead and click Import.
-
Close the Asset Store window.
-
We now have our new project with our assets imported.
-
And the default new empty scene open.
-
Before creating anything in the new scene
-
we need to save our scene.
-
We can save our scene by choosing
-
File - Save Scene,
-
or by using the keyboard shortcut
-
command + S on mac,
-
or control + S on windows.
-
I'm going to save this scene
-
in the Assets directory in the
-
folder called Scenes.
-
I'm going to call the scene Main.
-
We can now see in our Scenes folder
-
the scene called Main.
-
It's worth noting that the
-
Completed, Prefabs, Scenes, Scripts
-
and Sprites folders
-
were all created when we imported our asset package.
-
The Completed folder contains
-
a completed version of the project,
-
which you can refer to if you get stuck.
-
Great, that's the end of our first lesson.
-
In our next lesson we're going to lay out our play field.