Hi, thanks.
tileAt is not nil, in fact I can set a new position for the image, setOpacity and such things, I just can't animate it.
The code for the action is very simple:
--------------------
[[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
[NSString stringWithFormat:@"%@.plist",tipo]];
//CCSpriteSheet *sheet = [CCSpriteSheet spriteSheetWithFile:[NSString stringWithFormat:@"%@.png",tipo]];
int numeroFrames = 24;
float velocidadAnimacion = 0.1;
NSString *stringAnimacion = @"pinoanimado0";
NSMutableArray *arrayAnimacion = [NSMutableArray array];
for(int i = 1; i <= numeroFrames; ++i) {
[arrayAnimacion addObject:
[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
[NSString stringWithFormat:@"%@%d.png",stringAnimacion, i]]];
}
CCAnimation *objetoAnimacion = [CCAnimation animationWithName:@"animacion" delay:velocidadAnimacion frames:arrayAnimacion];
CCAction *accion = [CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:objetoAnimacion restoreOriginalFrame:NO]];
CCTMXLayer *layer = [tileMap layerNamed:@"Capa 0"];
// Running this action below gives error Assertion failure in -[CCSprite setTexture:]
imagen = (CCSprite*) [layer tileAt:posicion];
[imagen runAction:accion];
// THE CODE BELOW WORKS FINE
//CCSprite *imagen = [CCSprite spriteWithFile:@"pinoanimado024.png"];
//[self addChild:imagen];
//[imagen runAction:accion];
-----------------