Cocos2d Collision between two sprites prevent image jump/shift

141 Views Asked by At

I'm having an issue when my character sprite collides with a monster sprite, the monster sort of shifts as does the character sprite. By shift I mean, rotates the character slightly, and bounces the monster character a bit. How do I make it so the sprites don't actually shift position upon collision?

Here is the code I'm currently using

- (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;
}
0

There are 0 best solutions below