Game Development Reference
In-Depth Information
memory usage either. A sprite instance, excluding the texture memory, is less than a kilo-
byte.
For the following descriptions, open the Gear1.ccb and the Saw1.ccb in your second
pass.
Select the gear/saw sprite node, depending on whether you are in Gear1.ccb or Saw1.ccb,
and change the duration of the Default Timeline to 4 seconds, like in Figure 5-2 .
Those 4 seconds will be how long it takes to complete a full revolution. Feel free to vary
the duration a little if you like.
With the gear/saw sprite selected and the Timeline Cursor moved to the 00:00:00 loca-
tion on the far left, press the R key to create a keyframe. Then move the Timeline Cursor
to the far right of the Timeline and press R again to create a second keyframe. With the
Timeline Cursor still on the second keyframe, set the Rotation property to 360 on the
Item Properties tab. This will make the object rotate 360 degrees clockwise. To test
this out, press the Play button in the Timeline Controls. See Figure 5-1 .
Finally, the Timeline Chain needs to be changed from No chained timeline to Default
Timeline in order for the rotation animation to loop indefinitely. Be sure to left-click the
Timeline Chain drop-down menu because right-clicking won't work.
Repeat the preceding steps as many times as you like to create as many variations of rotat-
ing objects as you want.
Tip To create a counter-clockwise rotation animation, simply set the Rotation
property to -360 for the second keyframe. Alternatively, set Rotation in the first
keyframe to 360 and in the second keyframe set it to 0. Either way works fine.
You may want to create a duplicate CCB file with a different name so that you
can use both clockwise and counter-clockwise rotating objects in the level.
Theoretically, you could also change the x scale of selected gear or saw objects
in the level from 1 to -1, effectively flipping it and reversing the rotation anim-
ation. But at the time of this writing that did not correctly rotate the physics col-
lision shape. Generally speaking, keep a scale of -1 in the back of your head as
an easy way to not only flip images along one or both axes, but also as a way to
reverse the direction of the rotation and position animations.
Adding Gears and Saws to the Level
Search WWH ::




Custom Search