0

I'm rotating an instance of a CCLayer subclass like this:

[self runAction:[CCRotateBy actionWithDuration:0.5 angle:180.0]];

This rotating is in response to a user tap (which may come rapidly). How can I determine if the layer is currently being rotating? In this case I can just ignore the tap.

MrDatabase
  • 43,245
  • 41
  • 111
  • 153

1 Answers1

1

When declaring your CCAction, it is possible to set a tag attribute to it, and then retrieve the action by using getActionByTag. If the returning value is not nil, then it means that the action is actually running.

CCRotateBy *rotate = [CCRotateBy actionWithDuration:1.0 angle:100];
rotate.tag = 100;
[myNode runAction:rotate];
if ([myNode getActionByTag:100]) {
    NSLog(@"Rotating!!");
}
Saturn
  • 17,888
  • 49
  • 145
  • 271