I have two cpBodies, a hero and hurdle in my game play. when ever they collide I call a function and these two bodies are received in it. I need to stop both of these bodies.
I am using this code to stop them
static int Collisionfunction(cpArbiter *arb, cpSpace *space, void *unused)
{
cpShape *a, *b;
cpArbiterGetShapes(arb, &a, &b);
a->body->v = cpvzero;
b->body->v = cpvzero;
return 1;
}
Problem is that when they collide first time they are stopped. when I navigate player to go the opposite side from hurdle and again this collision function is called and player is unable to move again.
any idea to move player second time after first collision with hurdle.
I know it can be done using a BOOL flag to check its first time or second time. But I wish to do this with out using flag.
any idea?
thanks in advance