0

当我的角色精灵与怪物精灵碰撞时,我遇到了一个问题,怪物和角色精灵一样会发生变化。我的意思是,稍微旋转角色,并稍微反弹怪物角色。我怎样才能使精灵在碰撞时实际上不会移动位置?

这是我目前正在使用的代码

- (BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair collisionPlayer:(CCNode *)user collisionMonster:(CCNode *)monster
{

        [monster stopAllActions];

        [[OALSimpleAudio sharedInstance] playEffect:@"Zombie.mp3" volume:10.0f pitch:1.0f pan:0 loop:NO];

        CCActionRotateTo* actionSpin = [CCActionRotateBy actionWithDuration:0 angle:90];
        [monster runAction:actionSpin];

        CCActionDelay *corpseDecayDelay = [CCActionDelay actionWithDuration:0.8];
        CCActionFadeOut *corpseFade = [CCActionFadeOut actionWithDuration:0.5];

        CCActionRemove *removeElement = [CCActionRemove action];
        CCActionSequence* monsterDeathSequence = [CCActionSequence actions:corpseDecayDelay,corpseFade, removeElement, nil];
        [monster runAction:monsterDeathSequence];


        return YES;
}
4

0 回答 0