我正在尝试将精灵添加到 aNSMutableArray
但它没有添加它们。这就是我所拥有的:
NSMutableArray *tail;
CCSprite *block;
int j;
-(void)handleTail:(CCSprite*)pos{
CGPoint point= pos.position;
block = [CCSprite spriteWithFile:@"Icon-Small-50.png"];
//Adding the tail blocks
block.scale = .8;
block.color = ccGREEN;
block.position = point;
NSLog(@"Block Pos (%f,%f)",block.position.x,block.position.y);
//CGPoint playerPos = piece.position;
originalPos = point;
if ([tail count] < maxLength) {
[tileMap addChild:block];
[tail addObject:block];
NSLog(@"Tail length:%i",tail.count);
j+=1;
}
if (j == 3) {
NSLog(@"J called");
[tail removeObjectAtIndex:0];
}
}
我不明白为什么这不起作用?