Ok, I've got a weird game crash going on. I have a parallax node defined as:
voidNode = [ParallaxNode node];
[voidNode setPosition:ccp(240, 160)];
[self addChild:voidNode];
I am adding subclassed sprites (trees) to this voidNode, in this way:
trees = [[NSMutableArray alloc] initWithCapacity:knumberOfTestTrees];
for(int n=0; n<knumberOfTestTrees; n++) {
TreeSprite* tempSprite = [[TreeSprite newTreeSprite]retain];
int x = arc4random()%5;
int y = arc4random()%5;
[voidNode addChild:tempSprite z:4 parallaxRatio:ccp(1.0f,1.0f) positionOffset:ccp(-180+20*x,-180+20*y)]; //error
tempSprite.scale = 0.3f;
[trees addObject: tempSprite];
}
At the moment I am just creating a bunch of treeSprites, adding them to the parallax node, and then adding them to the 'trees' array. (Later on I'm going to set their positions etc via xml parsing, but that's a future hurdle).
Ok, so all works well when kNumberOfTestTrees is <= 10, but the moment I put it up to 11 (yeah, I know how it sounds!) I get a game crash on load with the error being where I add the sprites to the voidNode. The last bit in the error bit says _longcopy.
This is weird. Any ideas/suggestions?