I have this method:
Code:
for(CCSprite *sprite in mySprites){
CGPoint posizioneActual = sprite.position;
NSInteger posizioneInt = 0;
if (i determine the position of the sprite) posizioneInt = ..;
else if..
else if..
NSInteger spriteRotation = 0;
if(sprite.rotation == -90) spriteRotation = 1;
else if(sprite.rotation == 0) spriteRotation = 2;
else if(sprite.rotation == 90) spriteRotation = 3;
else if(sprite.rotation == 180) spriteRotation = 4;
NSArray *lastPosition = [NSArray arrayWithObjects:[NSNumber numberWithInt:posizioneInt], [NSNumber numberWithInt:spriteRotation], nil];
[actualState addObject:lastPosition];
actualState is a NSMutableArray, and I want to add all the position of the sprite (now contained in lastPosition) in actualState, so I have an array that contains other arrays.
But [actualState addObject:lastPosition]; doesn't work, the console sais:
2011-02-18 10:19:12.664 game[28165:207] actualState count = 0
Maybe I have to transform my array to add it as an object... but how?