Game Development Reference
In-Depth Information
CCB file, because the sprite is not the root node. The alternative of editing and animating
each gear and saw instance in the level separately simply wouldn't be feasible.
Animating the Gear and Saw
You can move on to animate the gear and saw objects. As before, I'll explain it once for
the
Gear1.ccb
and you should apply the same steps to the
Saw1.ccb
as well. You
don't necessarily have to, but I recommend doing it twice to get in the habit.
Feel free to create additional duplicates of
Gear1.ccb
and
Saw1.ccb
with essentially
the same content but different rotation animations. You could alter the speed, or make the
object rotate only by 180 degrees and then change direction. If you do that, you should
pick sensible names for the additional CCB files that describe what the object does. For
instance,
Gear1_180AndBack.ccb
might be a good name for the behavior I just de-
scribed.
Tip
Notice that there's currently no Duplicate command. But when there will
be, the most likely place to find that command will be in a CCB's right-click
context menu.
Fortunately, you can still duplicate CCB files using Finder. In Finder, you will
find all files listed in SpriteBuilder's
File View
in the SpriteBuilder Re-
sources folder under the project's root folder. For instance, the topic project's
Prefabs
files are stored in the
LearnSpriteBuild-
er.spritebuilder/SpriteBuilder Resources/Prefabs
folder.
You can simply copy and paste a .ccb file to create a duplicate in Finder, and
then rename it in Finder or SpriteBuilder. Copied CCB files will appear in
SpriteBuilder's
File View
momentarily. If you did not duplicate the corres-
ponding .ppng preview image, SpriteBuilder will generate it the next time you
save or publish the project.
This workaround even allows you to copy CCB files between projects, though
Sub File nodes and Sprite frame references contained within it are likely to be
lost in the process and will need to be set again.
Don't worry about creating too many duplicates—the published CCBi files are tiny (a few
kilobytes at most), and if the sprites all use the same image there's hardly any increase in
Search WWH ::
Custom Search