@pabloruiz55: oh no wonder... but what if I want it to run every second?
Can I repeat a runAction?
Or...
Can I do something like this?
id action = [CCCallFuncND actionWithTarget:self selector:@selector(addAimingBullet:) data:(Enemy*) enemy];
[self schedule:@selector(action:) interval: 0.1];
Or equivalent to that? 'coz that crashes.
Thanks.
Came across this thread via searching on how to do something similar to you purplelilgirl - the way I have got this to work for me (scheduling repeating methods via runAction) is by doing the following:
id actionDelay = [CCDelayTime actionWithDuration:5];
id actionDone = [CCCallFuncN actionWithTarget:self selector:@selector(startgameLogic:)];
[self runAction:[CCSequence actions:actionDelay, actionDone, nil]];
then I have my method "startgameLogic" that initiates 5 seconds after the start of this scene (because of the delay above). In this startgameLogic method (which only fires once), I then initiate my "real" "gameLogic" method by doing:
-(void)startgameLogic: (id)sender {
[self schedule:@selector(gameLogic:) interval:0.2 + ([sharedGameState difficulty]) - 0.3];
}
Hope this helps. If anyone has any better ideas please post them :) This seems to work well for me. I am also quite sure you could use:
id action = [CCRepeatForever actionWithAction:
in conjunction with CCCallFuncND though :)