Hello guys!
I have a sprite and I want it to act like a real ball when I press the fire button. So i want to shoot the ball. I think I need to use the Chipmunk library but until now I don't know how.
Here's a part of the code I have written:
_soccerBall = [CCSprite spriteWithFile:@"soccerBall.png"];
_soccerBall.position = ccp(_soccerBall.textureRect.size.width / 2, _soccerBall.textureRect.size.height / 2);
[self addChild:_soccerBall];
And I have also an other sprite for a fire button. Which calls the fire method when I press it.
I've tried something with chipmunk, since I don't have a body...
Here's the code that I tried. But the _soccerball isn't a cpbody, it is a CCSprite.
cpBodyApplyImpulse(_soccerBall, cpvmult(cpvsub( _touchPoint, _soccerBall.position), 0.7), cpvzero);
Maybe can you help me how to solve this?