I keep trying to get my array count but it keeps returning 0, i think its not adding the object correctly. I Put my property in header file and synthesized it in the layer.m file. i allocated space in my super init.
NSMutableArray *asteroids;
@property (strong) NSMutableArray *asteroids;
@synthesize asteroids;
self.asteroids = [[NSMutableArray alloc] init];
-(void)findTiles
{
CGPoint tilecoord1;
int tileGid1;
int aheadcount = 200;
CCSprite *tileonPos[aheadcount];
int amounts = 0;
for(int x = 0; x<30; x++)
{
for(int y = 0; y<20; y++)
{
tilecoord1 = ccp(x+(480*currentlevel),y);
tileGid1 = [bglayer tileGIDAt:tilecoord1];
if(tileGid1 == 1)
{
tileonPos[amounts] = [bglayer tileAt:ccp(x,y)];
amounts++;
[asteroids addObject:tileonPos[amounts]];
NSLog(@"%d",[asteroids count]);
}
}
}
}