Game Development Reference
In-Depth Information
Tip
If you find that you often need to use the
scheduleBlock:
trick to pre-
vent
space locked
errors, you should consider updating the
triggerActiv-
atedBy:
method in
Trigger.m
so that the call to
didTrigger-
WithNode:
is already deferred to a scheduled block. If you do that, you no
longer have to schedule blocks in
TriggerDelegate
classes, but on the oth-
er hand all
didTriggerWithNode:
messages will be deferred.
If you run the project now, the saws start rotating as soon as the player enters a trigger
area. The current state of the project can be found in the folder
06 - Triggered An-
imations
.
Summary
In this chapter, you've learned how to create keyframe animations using the Timeline edit-
or and how to play back these animations via
CCAnimationManager
.
You then added a generic
Trigger
class that allows you to run code whenever the player
enters a given trigger area. Trigger and target nodes are connected simply by giving them
the same name.
Search WWH ::
Custom Search