Inside of a class that subclasses CCNode
, I have scheduled an -update:(ccTime)dt
method. I also have a bunch of behavior objects that don't subclass CCNode
, but also have an -update:(ccTime)dt
method. Here's the inside of my CCNode
's update
method:
-(void)update:(ccTime)dt{
for(Behavior *currentBehavior in behaviors开发者_运维百科){
[currentBehavior update:dt];
}
}
When I NSLog
the dt
value passed into my CCNode
's update
, it prints out normal values (0.116699, 0.162726). However, when I NSLog
the dt
value from inside the behaviors' update
methods, the printed numbers are all of a sudden really screwed up (0.000, 36893488147419103232, -2.000). It's the strangest thing. When I debug it, I'll see that the first dt
value is normal, and then I'll step inside the behavior's update
, and the value will suddenly change to something crazy. What's going on?
I figured it out. I didn't have -update:(ccTime)dt
in my behavior class's .m file, and my theory is that it took the complier extra time to look for the method selector, which therefore screwed up the ccTime.
精彩评论