精灵的框架没有旋转

时间:2012-03-06 08:31:33

标签: iphone cocos2d-iphone box2d

在我的应用程序中,我试图拖动,旋转精灵并在geture结束时使用相同的精灵创建b2Body。我移动的精灵应该以零旋转返回他的位置。在将addind b2Body添加到世界之后,我称这种方法为:

- (void) reset
{
    [movableArea setRotation:0];

    [movableArea setPosition:backgroundSprite.position];
    [movableArea setContentSize: backgroundSprite.contentSize];
    [parameters removeAllObjects];
    [parameters setDictionary:originParameters];

    [castSprite removeFromParentAndCleanup:YES];
    [castSprite release];
    castSprite = [[CCSprite alloc] initWithSpriteFrameName:castFrameName];
    [castSprite setRotation:0];
    [castSprite setPosition:backgroundSprite.position];
    [castSprite setScale:(castSprite.contentSize.width > castSprite.contentSize.height ?
                  (backgroundSprite.contentSize.width / castSprite.contentSize.width / 1.1) :
                  (backgroundSprite.contentSize.height / castSprite.contentSize.height / 1.1)
                  )];
    [base addChild:castSprite z:0 tag:CAST_VISIBLE_TAG];
}

但有时精灵会出现旋转。通过断点我检查:sprite.rotation是0.在单次构建期间,相同的精灵会发生这种情况。我的意思是我建立项目,8个中的一个或两个精灵将全部轮换。建立另一个时间 - 可能还有其他精灵被窃听。这是为什么?

0 个答案:

没有答案
相关问题