My current solution to schedule the same selector on an object for n times is via creating an array of instances of a “messanger” class where as property I have calltime and type of the selector I want to call plus the object reference that should call the selector.
I then check against this array in the update method of the parent node class where I added all those objects.
Is there any way to do this via the schedule method?
The shared director doesn’t give me any method that helps. I am fairly happy with my solution but not quiet sure if it is the best one.
EDIT: I tried the answer suggested and unfortunately did not work.
Here is the code:
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:1.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:3.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:5.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:7.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:9.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:12.0f];
....
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:152.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:177.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:199.0f];
[f schedule:@selector(activateForShort) interval:0 repeat:0 delay:212.0f];
f is an object and it calls the selector “activateForShort” only once.
I tried modifying the interval and repeat value to 1 but did not work.
What I want to achieve is to call it at a specific time (e.g. 1.0f, 212.0f).
Any suggestion will be wellcome 🙂
The solution suggested sadly didn’t work. See edit.
I created a specific action class and created an NSMutableArray filled of instances of this class, and in the update method of the class wherever I needed those actions to be scheduled I do:
}