views:

10

answers:

0

Hi,

I use the following to to interchange only the position of 2 sprite.

CCSprite *sprite1 = (CCSprite*)[self getChildByTag:tagOfFirstSprite]; 
    CCSprite *sprite2 = (CCSprite*)[self getChildByTag:tagOfSecondSprite]; 

    CGPoint SpritePosition1 = [sprite1 position];  
    CGPoint SpritePosition2 = [sprite2 position];  



    [sprite1 runAction:[CCMoveTo actionWithDuration:1.0 position:ccp(SpritePosition2.x, SpritePosition2.y)]];
    [sprite2 runAction:[CCMoveTo actionWithDuration:1.0 position:ccp(SpritePosition1.x, SpritePosition1.y)]];

These are box2d body.But it doesn't work.......any idea??