I'm working on Cocos2D, and I need to make the sprite jump from position(x, y)
to position(width-x, y)
in a parabolic way. It's my first time working in game development.
How can I make the animation of jumping from one side to the other side?
My current piece of code while screen is tapped
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
CGSize screenSize = [[CCDirector sharedDirector] winSize];
if(!self.anim.flipY){
self.anim.position = ccp(screenSize.width - self.anim.position.x, self.anim.position.y);
self.anim.flipY = true;
}
else{
self.anim.position = ccp(screenSize.width - self.anim.position.x, self.anim.position.y);
self.anim.flipY = false;
}
}
I read on a forum, that it requires to use gravity and velocity? Any hint? I barely have an idea!