I have written a function that adds a ball to an array yet when I check the count it hasnt increased, please can someone advise.
NSMutableArray *_otherBalls;
-(void)addBall{
CCSprite *target = [CCSprite spriteWithFile:@"redbouncyball.gif" rect:CGRectMake(0, 0, 27, 40)];
[self addChild:target];
//add to our array
[_otherBalls addObject:target];
NSLog(@"Added ball : %@",[_otherBalls count]);
}
The log comes out as
Added ball : (null)
_otherBalls.count? did you mean[_otherBalls count]?countis not declared as a property and you shouldn't use it as such.