Hi,
I have two classes setup, class1 and class2, both subclassing CCSprite.
Now if I add instances of both these classes to the same array, then I thought I could do this:
for (class1 *object in array)
{
//do something
}
And it would only do something on the class1 objects. However I've noticed that it also does the same things to the class2 objects, which I tested by putting an NSLog in there. NSLog(@"object: %@",object)
So I'm just wondering if there's a way I can only do something on class1 objects, or if I need to make separate arrays for each class? I thought maybe this was because both classes are subclassing CCSprite? But wasn't sure if thats the reason or not! Maybe I'm just misunderstanding how this type of for loop works!
Thanks for the help!