런타임에 CCSprite 객체에서 이러한 메서드를 호출 할 수 있었으므로 이제 CCSpriteBatchNode에서 일괄 처리하기로 결정했습니다. t은 더 이상 작동하는 것 :Cocos2d : 스프라이트 노드에서 일괄 처리 된 CCSprite에 대한 런타임시 zOrder 설정이 작동하지 않는 것 같습니다.
sprt = [CCSprite spriteWithSpriteFrameName:@"sprt.png"];
sprt.anchorPoint = CGPointMake(0.5f, 0.5f);
sprt.position = CGPointMake(40.0f, 60.0f);
[batchNode addChild:sprt z:-1]; // It used to work when I was simply "adding as child" the sprt object, I guess now doesn't set the order anymore because somehow the CCSpriteBatch node doesn't allow the re-ordering of child added to it
CCCallFunc *callback = [CCCallFunc actionWithTarget:self selector:@selector(moveBackwards)];
CCCallFunc *callback2 = [CCCallFunc actionWithTarget:self selector:@selector(moveForward)];
[sprt runAction: [CCRepeatForever actionWithAction: [CCSequence actions: callback2, callback , nil]]];
-(void) moveBackwards
{
[sprt setZOrder:-1];
}
-(void) moveForward
{
[sprt setZOrder:1];
}
이 배치 노드의 다른 스프라이트 또는 상대적으로이 배치 노드에없는 객체에 비해 상대적으로 "작동하지 않습니까? – Kreiri
은 동일한 배치 노드에있는 노드에 – mm24