Game Development Reference
In-Depth Information
There are many platforms that a simple box collider would work properly on.
However, take a look at the imagery of this platform—it has an indentation on both
sides. If you were to put a simple box collider on this, the collision would go straight
down from the edges of the platform. Any bullet that collided with the box collider
would disappear, which wouldn't look correct. We want those bullets to disappear
when they hit the actual graphics. You now have a platform!
This would also be a good time to save your scene for the first time. Name it
RageTanksScene
and place the scene within a folder called
Scenes
.
Making new friends
With our platform made, let's make a hero. Back in the assets you downloaded from
the publisher's website, look for the folder labeled
Player
in the
Art
directory. Inside
the
Texture
folder in your project, create a new folder called
Player
and import the
image named
playerSpriteSheet.png
to that folder.
This image is what is referred to, obviously, as a
sprite sheet
, or a
sprite atlas
.
Essentially, it's just a collection of images; however, rather than each individual
image taking up space in memory, all of those images only take up one image in
memory. If that isn't clear, think of it like this: imagine you are hosting a holiday
dinner. You could have every ingredient you are cooking within a separate fridge
or every ingredient you are cooking all neatly organized in one fridge. The first
option will overload your home with boxes—it is the same idea here with video
memory and sprite sheets/atlases.
Say you already have a collection of sprites and need to turn them into a sprite
sheet. You could build that by hand in a tool such as Photoshop; however, that
gets somewhat tedious. There are some tools that can automatically build sprite
sheets—check out Shoebox and Texture Packer.
So, even though we can clearly see that this image is a sprite sheet, we need to let
Unity know. To do this, select
playerSpriteSheet
in the
Project
tab and look over at
the inspector. Find where it says
Sprite Mode
and change it to
Multiple
. You should
now see
Packing Tag
,
Pixels to Units
, and the
Sprite Editor
button. Whack that
Sprite Editor
button so we can edit the sprites.