I need to schedule an event in cosos2D with various arguments, I have tried searching on net but did not able to get any solution out of it. I can use
[self schedule:@selector(move:) interval:0.3];
but How should I pass arguments to it like:
[self schedule:@selector(move:withPoint:) interval:0.3];
to access this function.
-(void)move:(id)object withPoint:(CGPoint)point{ }
You should use some kind of enclosure (an array/dictionary, a struct, etc.) in an instance variable to achieve this. For example:
Hope this helps.
EDIT: as @learncocos2d pointed out, it’s also sufficient to create single instance variables (the object, the CGPoint…) and you don’t even need the overhead of the dictionary.