Game Development Reference
In-Depth Information
react to impulses and forces, including gravity. For immovable physics bodies, you would
instead choose the
Static
mode.
Bodies that are set to
Static
will never, ever change their position or rotation by them-
selves or through forces, no matter how hard other bodies impact it. You can still manu-
ally change a
Static
body's position and rotation, however. But for this exercise you
just need some nonanimated, rigid walls.
Creating the Wall Templates
You'll find all wall images for the first level in the
Level1b
spritesheet. The images are
named
level1_foreground_top1.png
through
level1_foreground_top7.png
. You can also use images you create yourself or
download from the Internet—the process is the same.
With the images at hand, add a subfolder in the
Prefabs
folder by right-clicking the
Prefabs
folder and choosing the
New Folder
option. Name the new folder
Borders
. Right-click the
Borders
folder, and create a
New File
.
Actually, you're going to create several files with wall templates, but I'm only going to
describe the creation of the first. The rest are created and edited in the same way and left
for you as an exercise.
In the
New File
dialog, consecutively name the file, starting with
Border1.ccb
, and
choose
Sprite
as its type. Then click
Create
.
After creating the
Border1.ccb
, select the
CCSprite
root node in the Timeline.
Change the sprite's
Sprite frame
property to
SpriteSheets/Level1b/
level1_foreground_top1.png
on the
Item Properties
tab in the
Details
Inspector
on the right.
Tip
If you are working with very dark, if not black, images, you may not be
able to make out the sprite's outline. If that is the case, you can go to Document
Stage Color and select a background color that gives you good contrast.
Gray
usually works well. Try
Green
if you have masochistic tendencies.
You may want to zoom in on the sprite to make it easier to edit its shape. Choose the
Zoom In
and
Zoom Out
commands from the
Document
menu to do so.
Search WWH ::
Custom Search