Hi,
I am developing a game in which if the Object comes in the range of the Shooter, it shoots it.
- My algo goes like this...
1. Once the Object comes in the Shooters range, I will fire a bullet from Shooter position to the Object's position.
2. This request will actually makes the bullet to travel from Tower to the Object.
id actionMove = [MoveTo actionWithDuration:0.5f position: objectPos]
[_bulletSprite runAction: actionMove];
_bulletBody->p = ccp(objectPos);
3. Once the Bullet hits the Object, the same kind of callback will be recieved.
Problem:
Now the issue is,
In the callback method,
static int bulletCollision(cpShape *a, cpShape *b, cpContact *contacts, int numContacts, cpFloat normal_coef, void *data)
{
a->body->p = ccp(-150, -150);
b->body->p = ccp(-250, -250);
}
This results into, object disappears first and then bullet reaches there with some time gap
Some more info:
My gameLayer refreshes by 1 sec
Can you please suggest why this delay was happening...
Regards
Mustafa
symadept@gmail.com